|
发表于 2013-9-9 17:14:08
|
显示全部楼层
手动改要死人的。
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:" ?editable t);
NL_GSform1 =hiCreateAppForm( ?name 'NL_GSform1 ?fields list(NL_GSfieldgrid ) ?callback "NL_RoundGridCB(hiGetCurrentForm())");
hiDisplayForm(NL_GSform1);
)
)
NL_RoundGrid()
复制代码另存为offgrid
用法:
1. Select the layout
2. in CIW, type: load("pathname/offgrid")
3. “Enter” to Execute |
|