Regards
Stewart
procedure(NL_RoundGridSub(point grid)
point=list(round(car(point)/grid)*grid round(cadr(point)/grid)*grid )
)
procedure(NL_RoundGridS(cv,grid)
foreach(shape cv~>shapes
if((shape~>objType == "rect")
then
shape~>bBox=list(NL_RoundGridSub(car(shape~>bBox),grid) NL_RoundGridSub(cadr(shape~>bBox),grid))
)
if((shape~>objType == "path")
then
newpoints=nil
foreach(point shape~>points
newpoints=cons(NL_RoundGridSub(point grid ) newpoints)
)
shape~>points=newpoints
shape~>width=round(shape~>width/2.0/grid)*2.0*grid
)
if((shape~>objType == "polygon")
then
newpoints=nil
foreach(point shape~>points
newpoints=cons(NL_RoundGridSub(point grid ) newpoints)
)
shape~>points=newpoints
)
)
foreach(inst cv~>instances
inst~>xy=NL_RoundGridSub(inst~>xy,grid)
)
)
procedure(NL_RoundGridCB(theform)
cv=geGetEditCellView()
grid=theform~>NL_GSfieldgrid~>value
NL_RoundGridS(cv,grid)
)
procedure( NL_RoundGrid()
let( (NL_GSfieldlib NL_GSform1 )
NL_GSfieldgrid =hiCreateFloatField( ?name 'NL_GSfieldgrid ?value 0.01 ?prompt "Final Grid:" ?edita
ble t);
NL_GSform1 =hiCreateAppForm( ?name 'NL_GSform1 ?fields list(NL_GSfieldgrid ) ?callback "NL_RoundGri
dCB(hiGetCurrentForm())");
hiDisplayForm(NL_GSform1);
)
)
NL_RoundGrid()
This rounds all vertices to grid on the current layout cellview
Thanks very much for that, it's sure to come in useful. Obviously
everything needs to be checked for problems afterwards but it's done the
trick on the design I'm working on at the moment.
Cheers
Stewart