S
sridhartv25@gmail.com
Guest
Hello all,
***************************Program to convert Rectangle and Regular
Polygon to path****************************
The program given below converts rectangle and regular polygon to
path, I had tried to cover many cases but still some strange cases may
fail to create the path. After writing the complete script I could say
that still a better
program can be written in a much shorter version, surely I will update
that script with in few days which could convert
any regular polygon to path.
One important condition while converting a polygon to path is the
polygon width must be same all along its length what ever may be the
direction or the no of bends it have.
I thank all the members of this forum especially Andrew and Riad Kaced
for thier support.
here it is
;Skill starts here
/*
Usage: Just Select a Polygon or a Rectangle in your Layout window to
be converted to path then copy the code into the icfb that's it else
copy the code in a file say path.il and then use the following command
in the icfb loadi("path of the file").
*/
procedure( polytopath()
win=hiGetCurrentWindow()
cv = deGetCellView()
db = car( geGetSelectedSet(cv))
test=0
if( db~>objType == "rect" then
mo=db~>layer
lo=leftEdge(db)
ro=rightEdge(db)
bo=bottomEdge(db)
to=topEdge(db)
cn1=to-bo
cn2=ro-lo
if(cn1>cn2 then
co=(lo+ro)/2
width=abs(lo-ro)
list1=co:bo
list2=co:to
full=list(list1 list2)
test=dbCreatePath(cv mo full width)
geDeleteSelSet(win)
)
if(cn2>=cn1 then
co1=(bo+to)/2
widthl1=abs(to-bo)
listl1=lo:co1
listl2=ro:co1
fulll=list(listl1 listl2)
test=dbCreatePath(cv mo fulll widthl1)
geDeleteSelSet(win)
)
)
if( db~>objType == "polygon" then ;;;;;;;;Case 1
mo=db~>layer
h=list(0 0)
s=db~>points
w=length(s)/2
;w=3
p=w-1
for(i 0 (length(s)/2)-1
;for(i 0 2
m=car(nth(w s))
n=car(nth(p s))
q=car(cdr(nth(w s)))
f=car(cdr(nth(p s)))
z=(m+n)/2
x=(q+f)/2
stack=list(z x)
h=append(h list(stack))
w=w+1
p=p-1
i=i+1
)
a=cddr(h)
;if( evenp(length(s)) then
;dep=car(cdr(nth((length(s)/2)-1 s)))
;dep1=car(cdr(nth(length(s)/2 s)))
;wid = abs(dep1-dep))
;if( oddp(length(s)) then
wid=abs(f-q)
if(wid!=0 then
id1=dbCreatePath(cv mo a wid)
bboxrec=db~>bBox
bboxpoly=id1~>bBox
if( bboxrec == bboxpoly then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec != bboxpoly then
geDeselectAllFig()
geSelectFig(id1)
dbDeleteObject(id1)
;geDeleteSelSet(win)
))
))
if( db~>objType == "polygon" then ;;;;;;case2
mo=db~>layer
h2=list(0 0)
s2=db~>points
w2=(length(s2)/2) +1
p2=w2-1
for(i2 0 (length(s2)/2)-2
m2=car(nth(w2 s2))
n2=car(nth(p2 s2))
q2=car(cdr(nth(w2 s2)))
f2=car(cdr(nth(p2 s2)))
z2=(m2+n2)/2
x2=(q2+f2)/2
stack2=list(z2 x2)
h2=append(h2 list(stack2))
w2=w2+1
p2=p2-1
i2=i2+1
)
a2=cddr(h2)
wid2=abs(f2-q2)
firgetp21=car(nth(0 s2))
firgetw21=car(nth(1 s2))
firmix1=(firgetp21+firgetw21)/2
firgetp22=car(cdr(nth(0 s2)))
firgetw22=car(cdr(nth(1 s2)))
firmix2=(firgetp22+firgetw22)/2
mix12=list(firmix1 firmix2)
a2=append(a2 list(mix12))
if(wid2!=0 then
id2=dbCreatePath(cv mo a2 wid2)
bboxrec2=db~>bBox
bboxpoly2=id2~>bBox
if( bboxrec2 == bboxpoly2 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec2 != bboxpoly2 then
geDeselectAllFig()
geSelectFig(id2)
dbDeleteObject(id2)
;geDeleteSelSet(win)
))
))
if( db~>objType == "polygon" then ;;;;;;;case3
mo=db~>layer
s3=db~>points
w3=length(s3)-3
p3=0
;dummyh3=list(0 0)
;h3=append(h3 list(dummyh3))
h3=list(0 0)
ldw3=length(s3)-1
ldp3=length(s3)-2 ;;;or ldw3-1
lasgetp31=car(nth(ldp3 s3))
lasgetw31=car(nth(ldw3 s3))
lasmix31=(lasgetp31+lasgetw31)/2
lasgetp32=car(cdr(nth(ldp3 s3)))
lasgetw32=car(cdr(nth(ldw3 s3)))
lasmix32=(lasgetp32+lasgetw32)/2
mix312=list(lasmix31 lasmix32)
;h3=mix312
h3=append(h3 list(mix312))
for(i3 0 (length(s3)/2)-2
m3=car(nth(w3 s3))
n3=car(nth(p3 s3))
q3=car(cdr(nth(w3 s3)))
f3=car(cdr(nth(p3 s3)))
z3=(m3+n3)/2
x3=(q3+f3)/2
stack3=list(z3 x3)
h3=append(h3 list(stack3))
w3=w3-1
p3=p3+1
i3=i3+1
)
;dummyh3=list(0 0)
;h3=append(h3 list(dummyh3))
;a3=remove( list(0 0) h3 )
a3=cddr(h3)
wid3=abs(n3-m3)
widr=abs(f3-q3)
if( wid3 == 0 then
id3=dbCreatePath(cv mo a3 widr)
)
if( widr == 0 then
;'else
id3=dbCreatePath(cv mo a3 wid3))
bboxrec3=db~>bBox
bboxpoly3=id3~>bBox
if( bboxrec3 == bboxpoly3 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec3 != bboxpoly3 then
geDeselectAllFig()
geSelectFig(id3)
dbDeleteObject(id3)
;geDeleteSelSet(win)
)
))
if( db~>objType == "polygon" then ;;;;;;;case4
mo=db~>layer
s4=db~>points
pl4=(length(s4)/2)
el4=pl4/2
p4=(el4+pl4)-1
w4=(el4+pl4)
y4=(length(s4)/2)-1
t4=0
h4=list(0 0)
for(i4 0 el4-1
m4=car(nth(w4 s4))
n4=car(nth(p4 s4))
q4=car(cdr(nth(w4 s4)))
f4=car(cdr(nth(p4 s4)))
z4=(m4+n4)/2
x4=(q4+f4)/2
stack4=list(z4 x4)
h4=append(h4 list(stack4))
w4=w4+1
p4=p4-1
i4=i4+1
)
for(il4 0 el4-1
mn4=car(nth(t4 s4))
nn4=car(nth(y4 s4))
qn4=car(cdr(nth(t4 s4)))
fn4=car(cdr(nth(y4 s4)))
zn4=(mn4+nn4)/2
xn4=(qn4+fn4)/2
stackn4=list(zn4 xn4)
h4=append(h4 list(stackn4))
y4=y4-1
t4=t4+1
il4=il4+1
)
a4=cddr(h4)
wid4=abs(f4-q4)
if(wid4!=0 then
id4=dbCreatePath(cv mo a4 wid4)
bboxrec4=db~>bBox
bboxpoly4=id4~>bBox
if( bboxrec4 == bboxpoly4 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec4 != bboxpoly4 then
geDeselectAllFig()
geSelectFig(id4)
dbDeleteObject(id4)
;geDeleteSelSet(win)
))
))
if( db~>objType == "polygon" then ;;;;;;;case5
mo=db~>layer
s5=db~>points
w5=(length(s5)/2)-2
p5=w5-1
wo5=length(s5)-1
po5=(length(s5)/2)+1
h5=list(0 0)
for(i5 0 (length(s5)/2)-3
m5=car(nth(w5 s5))
n5=car(nth(p5 s5))
q5=car(cdr(nth(w5 s5)))
f5=car(cdr(nth(p5 s5)))
z5=(m5+n5)/2
x5=(q5+f5)/2
stack5=list(z5 x5)
h5=append(h5 list(stack5))
w5=w5+1
p5=p5-1
i5=i5+1
)
for(io5 0 (length(s5)/2)-4
mo5=car(nth(wo5 s5))
no5=car(nth(po5 s5))
qo5=car(cdr(nth(wo5 s5)))
fo5=car(cdr(nth(po5 s5)))
zo5=(mo5+no5)/2
xo5=(qo5+fo5)/2
stacko5=list(zo5 xo5)
h5=append(h5 list(stacko5))
wo5=wo5-1
po5=po5+1
io5=io5+1
)
a5=cddr(h5)
wid5=abs(n5-m5)
;widr=abs(f5-q3)
if(wid5!=0 then
id5=dbCreatePath(cv mo a5 wid5)
bboxrec5=db~>bBox
bboxpoly5=id5~>bBox
if( bboxrec5 == bboxpoly5 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec5 != bboxpoly5 then
geDeselectAllFig()
geSelectFig(id5)
dbDeleteObject(id5)
))
))
if( db~>objType == "polygon" then
mo=db~>layer
s6=db~>points
v=(length(s6)/2)+1
v1=((length(s6)-v)/2)-1
w6=length(s6)-1
p6=(length(s6)/2)+1
wo6=(length(s6)/2)
po6=0
h6=list(0 0)
for(io6 0 (length(s6)/2)-4
mo6=car(nth(wo6 s6))
no6=car(nth(po6 s6))
qo6=car(cdr(nth(wo6 s6)))
fo6=car(cdr(nth(po6 s6)))
zo6=(mo6+no6)/2
xo6=(qo6+fo6)/2
stacko6=list(zo6 xo6)
h6=append(h6 list(stacko6))
wo6=wo6-1
po6=po6+1
io6=io6+1
)
h6=reverse(cddr(h6))
for(i6 0 v1
m6=car(nth(w6 s6))
n6=car(nth(p6 s6))
q6=car(cdr(nth(w6 s6)))
f6=car(cdr(nth(p6 s6)))
z6=(m6+n6)/2
x6=(q6+f6)/2
stack6=list(z6 x6)
h6=append(h6 list(stack6))
w6=w6-1
p6=p6+1
i6=i6+1
)
wid6=abs(n6-m6)
if(wid6!=0 then
id6=dbCreatePath(cv mo h6 wid6)
bboxrec6=db~>bBox
bboxpoly6=id6~>bBox
if( bboxrec6 == bboxpoly6 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec6 != bboxpoly6 then
geDeselectAllFig()
geSelectFig(id6)
dbDeleteObject(id6)
))
))
if( db~>objType == "polygon" then
mo=db~>layer
s7=db~>points
v=(((length(s7)/2)-1)/2)-1
w7=(length(s7)/2)-2
p7=0
wo7=length(s7)-1
po7=(length(s7)/2)-1
h7=list(0 0)
for(i7 0 v
m7=car(nth(w7 s7))
n7=car(nth(p7 s7))
q7=car(cdr(nth(w7 s7)))
f7=car(cdr(nth(p7 s7)))
z7=(m7+n7)/2
x7=(q7+f7)/2
stack7=list(z7 x7)
h7=append(h7 list(stack7))
w7=w7-1
p7=p7+1
i7=i7+1
)
h7=cddr(h7)
h7=reverse(h7)
for(io7 0 (length(s7)/2)-3
mo7=car(nth(wo7 s7))
no7=car(nth(po7 s7))
qo7=car(cdr(nth(wo7 s7)))
fo7=car(cdr(nth(po7 s7)))
zo7=(mo7+no7)/2
xo7=(qo7+fo7)/2
stacko7=list(zo7 xo7)
h7=append(h7 list(stacko7))
wo7=wo7-1
po7=po7+1
io7=io7+1
)
wid7=abs(no7-mo7)
if(wid7!=0 then
id7=dbCreatePath(cv mo h7 wid7)
bboxrec7=db~>bBox
bboxpoly7=id7~>bBox
if( bboxrec7 == bboxpoly7 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec7 != bboxpoly7 then
geDeselectAllFig()
geSelectFig(id7)
dbDeleteObject(id7)
))
))
if( db~>objType == "path" then
;geDeselectAllFig()
hiDisplayAppDBox(
?name 'Error
?dboxBanner "Error"
?dboxText sprintf(nil "Cannot convert Path to
Path")
?buttonLayout 'UserDefined
?buttons list("Close")
))
if( db~>objType == "inst" then
;geDeselectAllFig()
hiDisplayAppDBox(
?name 'Errtor
?dboxBanner "Error"
?dboxText sprintf(nil "Cannot convert Instance to
Path")
?buttonLayout 'UserDefined
?buttons list("Close")
))
;sel=geGetSelectedSet()
;if( sel == nil then
;hiDisplayAppDBox(
; ?name 'Eroot
; ?dboxBanner "Error"
;?dboxText sprintf(nil " No object is selected \n
\n Please select one")
; ?buttonLayout 'UserDefined
;?buttons list("Close")
)
if(test==0 then
hiDisplayAppDBox(
?name 'ERT
?dboxBanner "Error"
?dboxText sprintf(nil "Path not Created, Still the
script need tobe updated\n To create the path see the hints given
above")
?buttonLayout 'UserDefined
?buttons list("Close") )
))
polytopath()
;Skill ends here
I will try to update the script by using the local variables.
Any suggestions and comments please to make it perfect.
***************************Program to convert Rectangle and Regular
Polygon to path****************************
The program given below converts rectangle and regular polygon to
path, I had tried to cover many cases but still some strange cases may
fail to create the path. After writing the complete script I could say
that still a better
program can be written in a much shorter version, surely I will update
that script with in few days which could convert
any regular polygon to path.
One important condition while converting a polygon to path is the
polygon width must be same all along its length what ever may be the
direction or the no of bends it have.
I thank all the members of this forum especially Andrew and Riad Kaced
for thier support.
here it is
;Skill starts here
/*
Usage: Just Select a Polygon or a Rectangle in your Layout window to
be converted to path then copy the code into the icfb that's it else
copy the code in a file say path.il and then use the following command
in the icfb loadi("path of the file").
*/
procedure( polytopath()
win=hiGetCurrentWindow()
cv = deGetCellView()
db = car( geGetSelectedSet(cv))
test=0
if( db~>objType == "rect" then
mo=db~>layer
lo=leftEdge(db)
ro=rightEdge(db)
bo=bottomEdge(db)
to=topEdge(db)
cn1=to-bo
cn2=ro-lo
if(cn1>cn2 then
co=(lo+ro)/2
width=abs(lo-ro)
list1=co:bo
list2=co:to
full=list(list1 list2)
test=dbCreatePath(cv mo full width)
geDeleteSelSet(win)
)
if(cn2>=cn1 then
co1=(bo+to)/2
widthl1=abs(to-bo)
listl1=lo:co1
listl2=ro:co1
fulll=list(listl1 listl2)
test=dbCreatePath(cv mo fulll widthl1)
geDeleteSelSet(win)
)
)
if( db~>objType == "polygon" then ;;;;;;;;Case 1
mo=db~>layer
h=list(0 0)
s=db~>points
w=length(s)/2
;w=3
p=w-1
for(i 0 (length(s)/2)-1
;for(i 0 2
m=car(nth(w s))
n=car(nth(p s))
q=car(cdr(nth(w s)))
f=car(cdr(nth(p s)))
z=(m+n)/2
x=(q+f)/2
stack=list(z x)
h=append(h list(stack))
w=w+1
p=p-1
i=i+1
)
a=cddr(h)
;if( evenp(length(s)) then
;dep=car(cdr(nth((length(s)/2)-1 s)))
;dep1=car(cdr(nth(length(s)/2 s)))
;wid = abs(dep1-dep))
;if( oddp(length(s)) then
wid=abs(f-q)
if(wid!=0 then
id1=dbCreatePath(cv mo a wid)
bboxrec=db~>bBox
bboxpoly=id1~>bBox
if( bboxrec == bboxpoly then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec != bboxpoly then
geDeselectAllFig()
geSelectFig(id1)
dbDeleteObject(id1)
;geDeleteSelSet(win)
))
))
if( db~>objType == "polygon" then ;;;;;;case2
mo=db~>layer
h2=list(0 0)
s2=db~>points
w2=(length(s2)/2) +1
p2=w2-1
for(i2 0 (length(s2)/2)-2
m2=car(nth(w2 s2))
n2=car(nth(p2 s2))
q2=car(cdr(nth(w2 s2)))
f2=car(cdr(nth(p2 s2)))
z2=(m2+n2)/2
x2=(q2+f2)/2
stack2=list(z2 x2)
h2=append(h2 list(stack2))
w2=w2+1
p2=p2-1
i2=i2+1
)
a2=cddr(h2)
wid2=abs(f2-q2)
firgetp21=car(nth(0 s2))
firgetw21=car(nth(1 s2))
firmix1=(firgetp21+firgetw21)/2
firgetp22=car(cdr(nth(0 s2)))
firgetw22=car(cdr(nth(1 s2)))
firmix2=(firgetp22+firgetw22)/2
mix12=list(firmix1 firmix2)
a2=append(a2 list(mix12))
if(wid2!=0 then
id2=dbCreatePath(cv mo a2 wid2)
bboxrec2=db~>bBox
bboxpoly2=id2~>bBox
if( bboxrec2 == bboxpoly2 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec2 != bboxpoly2 then
geDeselectAllFig()
geSelectFig(id2)
dbDeleteObject(id2)
;geDeleteSelSet(win)
))
))
if( db~>objType == "polygon" then ;;;;;;;case3
mo=db~>layer
s3=db~>points
w3=length(s3)-3
p3=0
;dummyh3=list(0 0)
;h3=append(h3 list(dummyh3))
h3=list(0 0)
ldw3=length(s3)-1
ldp3=length(s3)-2 ;;;or ldw3-1
lasgetp31=car(nth(ldp3 s3))
lasgetw31=car(nth(ldw3 s3))
lasmix31=(lasgetp31+lasgetw31)/2
lasgetp32=car(cdr(nth(ldp3 s3)))
lasgetw32=car(cdr(nth(ldw3 s3)))
lasmix32=(lasgetp32+lasgetw32)/2
mix312=list(lasmix31 lasmix32)
;h3=mix312
h3=append(h3 list(mix312))
for(i3 0 (length(s3)/2)-2
m3=car(nth(w3 s3))
n3=car(nth(p3 s3))
q3=car(cdr(nth(w3 s3)))
f3=car(cdr(nth(p3 s3)))
z3=(m3+n3)/2
x3=(q3+f3)/2
stack3=list(z3 x3)
h3=append(h3 list(stack3))
w3=w3-1
p3=p3+1
i3=i3+1
)
;dummyh3=list(0 0)
;h3=append(h3 list(dummyh3))
;a3=remove( list(0 0) h3 )
a3=cddr(h3)
wid3=abs(n3-m3)
widr=abs(f3-q3)
if( wid3 == 0 then
id3=dbCreatePath(cv mo a3 widr)
)
if( widr == 0 then
;'else
id3=dbCreatePath(cv mo a3 wid3))
bboxrec3=db~>bBox
bboxpoly3=id3~>bBox
if( bboxrec3 == bboxpoly3 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec3 != bboxpoly3 then
geDeselectAllFig()
geSelectFig(id3)
dbDeleteObject(id3)
;geDeleteSelSet(win)
)
))
if( db~>objType == "polygon" then ;;;;;;;case4
mo=db~>layer
s4=db~>points
pl4=(length(s4)/2)
el4=pl4/2
p4=(el4+pl4)-1
w4=(el4+pl4)
y4=(length(s4)/2)-1
t4=0
h4=list(0 0)
for(i4 0 el4-1
m4=car(nth(w4 s4))
n4=car(nth(p4 s4))
q4=car(cdr(nth(w4 s4)))
f4=car(cdr(nth(p4 s4)))
z4=(m4+n4)/2
x4=(q4+f4)/2
stack4=list(z4 x4)
h4=append(h4 list(stack4))
w4=w4+1
p4=p4-1
i4=i4+1
)
for(il4 0 el4-1
mn4=car(nth(t4 s4))
nn4=car(nth(y4 s4))
qn4=car(cdr(nth(t4 s4)))
fn4=car(cdr(nth(y4 s4)))
zn4=(mn4+nn4)/2
xn4=(qn4+fn4)/2
stackn4=list(zn4 xn4)
h4=append(h4 list(stackn4))
y4=y4-1
t4=t4+1
il4=il4+1
)
a4=cddr(h4)
wid4=abs(f4-q4)
if(wid4!=0 then
id4=dbCreatePath(cv mo a4 wid4)
bboxrec4=db~>bBox
bboxpoly4=id4~>bBox
if( bboxrec4 == bboxpoly4 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec4 != bboxpoly4 then
geDeselectAllFig()
geSelectFig(id4)
dbDeleteObject(id4)
;geDeleteSelSet(win)
))
))
if( db~>objType == "polygon" then ;;;;;;;case5
mo=db~>layer
s5=db~>points
w5=(length(s5)/2)-2
p5=w5-1
wo5=length(s5)-1
po5=(length(s5)/2)+1
h5=list(0 0)
for(i5 0 (length(s5)/2)-3
m5=car(nth(w5 s5))
n5=car(nth(p5 s5))
q5=car(cdr(nth(w5 s5)))
f5=car(cdr(nth(p5 s5)))
z5=(m5+n5)/2
x5=(q5+f5)/2
stack5=list(z5 x5)
h5=append(h5 list(stack5))
w5=w5+1
p5=p5-1
i5=i5+1
)
for(io5 0 (length(s5)/2)-4
mo5=car(nth(wo5 s5))
no5=car(nth(po5 s5))
qo5=car(cdr(nth(wo5 s5)))
fo5=car(cdr(nth(po5 s5)))
zo5=(mo5+no5)/2
xo5=(qo5+fo5)/2
stacko5=list(zo5 xo5)
h5=append(h5 list(stacko5))
wo5=wo5-1
po5=po5+1
io5=io5+1
)
a5=cddr(h5)
wid5=abs(n5-m5)
;widr=abs(f5-q3)
if(wid5!=0 then
id5=dbCreatePath(cv mo a5 wid5)
bboxrec5=db~>bBox
bboxpoly5=id5~>bBox
if( bboxrec5 == bboxpoly5 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec5 != bboxpoly5 then
geDeselectAllFig()
geSelectFig(id5)
dbDeleteObject(id5)
))
))
if( db~>objType == "polygon" then
mo=db~>layer
s6=db~>points
v=(length(s6)/2)+1
v1=((length(s6)-v)/2)-1
w6=length(s6)-1
p6=(length(s6)/2)+1
wo6=(length(s6)/2)
po6=0
h6=list(0 0)
for(io6 0 (length(s6)/2)-4
mo6=car(nth(wo6 s6))
no6=car(nth(po6 s6))
qo6=car(cdr(nth(wo6 s6)))
fo6=car(cdr(nth(po6 s6)))
zo6=(mo6+no6)/2
xo6=(qo6+fo6)/2
stacko6=list(zo6 xo6)
h6=append(h6 list(stacko6))
wo6=wo6-1
po6=po6+1
io6=io6+1
)
h6=reverse(cddr(h6))
for(i6 0 v1
m6=car(nth(w6 s6))
n6=car(nth(p6 s6))
q6=car(cdr(nth(w6 s6)))
f6=car(cdr(nth(p6 s6)))
z6=(m6+n6)/2
x6=(q6+f6)/2
stack6=list(z6 x6)
h6=append(h6 list(stack6))
w6=w6-1
p6=p6+1
i6=i6+1
)
wid6=abs(n6-m6)
if(wid6!=0 then
id6=dbCreatePath(cv mo h6 wid6)
bboxrec6=db~>bBox
bboxpoly6=id6~>bBox
if( bboxrec6 == bboxpoly6 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec6 != bboxpoly6 then
geDeselectAllFig()
geSelectFig(id6)
dbDeleteObject(id6)
))
))
if( db~>objType == "polygon" then
mo=db~>layer
s7=db~>points
v=(((length(s7)/2)-1)/2)-1
w7=(length(s7)/2)-2
p7=0
wo7=length(s7)-1
po7=(length(s7)/2)-1
h7=list(0 0)
for(i7 0 v
m7=car(nth(w7 s7))
n7=car(nth(p7 s7))
q7=car(cdr(nth(w7 s7)))
f7=car(cdr(nth(p7 s7)))
z7=(m7+n7)/2
x7=(q7+f7)/2
stack7=list(z7 x7)
h7=append(h7 list(stack7))
w7=w7-1
p7=p7+1
i7=i7+1
)
h7=cddr(h7)
h7=reverse(h7)
for(io7 0 (length(s7)/2)-3
mo7=car(nth(wo7 s7))
no7=car(nth(po7 s7))
qo7=car(cdr(nth(wo7 s7)))
fo7=car(cdr(nth(po7 s7)))
zo7=(mo7+no7)/2
xo7=(qo7+fo7)/2
stacko7=list(zo7 xo7)
h7=append(h7 list(stacko7))
wo7=wo7-1
po7=po7+1
io7=io7+1
)
wid7=abs(no7-mo7)
if(wid7!=0 then
id7=dbCreatePath(cv mo h7 wid7)
bboxrec7=db~>bBox
bboxpoly7=id7~>bBox
if( bboxrec7 == bboxpoly7 then
;geDeleteSelSet(win)
test=dbDeleteObject(db)
)
if( db~>objType == "polygon" then
if( bboxrec7 != bboxpoly7 then
geDeselectAllFig()
geSelectFig(id7)
dbDeleteObject(id7)
))
))
if( db~>objType == "path" then
;geDeselectAllFig()
hiDisplayAppDBox(
?name 'Error
?dboxBanner "Error"
?dboxText sprintf(nil "Cannot convert Path to
Path")
?buttonLayout 'UserDefined
?buttons list("Close")
))
if( db~>objType == "inst" then
;geDeselectAllFig()
hiDisplayAppDBox(
?name 'Errtor
?dboxBanner "Error"
?dboxText sprintf(nil "Cannot convert Instance to
Path")
?buttonLayout 'UserDefined
?buttons list("Close")
))
;sel=geGetSelectedSet()
;if( sel == nil then
;hiDisplayAppDBox(
; ?name 'Eroot
; ?dboxBanner "Error"
;?dboxText sprintf(nil " No object is selected \n
\n Please select one")
; ?buttonLayout 'UserDefined
;?buttons list("Close")
)
if(test==0 then
hiDisplayAppDBox(
?name 'ERT
?dboxBanner "Error"
?dboxText sprintf(nil "Path not Created, Still the
script need tobe updated\n To create the path see the hints given
above")
?buttonLayout 'UserDefined
?buttons list("Close") )
))
polytopath()
;Skill ends here
I will try to update the script by using the local variables.
Any suggestions and comments please to make it perfect.