DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

ent_minbound, end_maxbound parameters

Started by bdeck, December 18, 2008, 01:59:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bdeck

The macro below is intended to move the origin to a buffered distance from the minimum x and y in drawing.

The minbound and maxbound paramters appear to be flaky.

I have abandoned this method, but am still curious about what is wrong with these parameters (in 17.2)

BD

Alias ENT_NPTS  &H010D
Alias ENT_POINT  &H010E
Alias ENT_LAYER  &H0102
Alias ENT_MINBOUND  &H010F
Alias ENT_MAXBOUND  &H0110 
Alias ENT_TYPE  &H0101
Alias ENT_GROUPINDEX &H0115

ne=sys(9)

xbuf=.25
ybuf=.25

minx=10000
miny=10000
maxx=-10000
maxy=-10000

for n=1 to ne
entity n
query ent_type, type
'if type=1 then
entity n
query ENT_MINBOUND, x,y,z
print "Min x,y", x,y
anykey
if x<minx then minx=x
if y<miny then miny=y
entity n
query ENT_MAXBOUND, x,y,z 
print "Max x,y", x,y
anykey
if x>maxx then maxx=x
if y>maxy then maxy=y
'endif
next n

x=minx-xbuf
y=miny-ybuf
z=0

print minx, miny, maxx, maxy,xbuf,ybuf,x,y,z
anykey

>Origin
{
<pointxyz [x, y, z]
}

end


Dempsey

bdeck,

Remember that we had that discussion in http://forum.designcad.com/index.php?topic=1535.0? For minbound and maxbound to work properly you have to properly select an object by setting a point on it, either before executing the macro or in the macro.  Doing GETSELECT and/or ENTITY in the macro is not good enough. Does this help?
Dempsey

bdeck

#2
Hi Dempsey,

That helps enough to remind me that this is a bug that needs fixing. (I see the problem now even with simple 2d entities) I think we agree that one should not have to select an entity prior to using the query statement.

In my macro, If the entities start on the origin, then the bug is not noticeable.

But if one tries to move them to the origin from elsewhere, then the macro creates a real mess. And each successive run of the macro is worse.


Thanks,

BD.