Skip to content

Commit e8573ad

Browse files
committed
fixed a couple of bugs
1 parent 99e8bf3 commit e8573ad

4 files changed

Lines changed: 41 additions & 21 deletions

File tree

grain.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>layoutDD</name>
44
<token/>
55
<hidden>false</hidden>
6-
<version>0.4.2</version>
6+
<version>0.4.3</version>
77
<api-version/>
88
<title>layoutDD</title>
99
<doc>Provides commands for Decomposition of Layout in a set of Subdomains.</doc>

pymacros/layoutDD.lym

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ if sys.platform=="win32":
2828
FCbinPath =os.path.realpath(FCdir+"/bin")
2929
if not FCbinPath in sys.path:
3030
sys.path.append(FCbinPath)
31+
elif sys.platform=="linux":
32+
FCpath=os.path.realpath("/usr/local/lib/")
33+
if not FCpath in sys.path:
34+
sys.path.append(FCpath)
3135

3236
#pya.MessageBox.info("Information", "This is the new macro created with the sample macro package", pya.MessageBox.Ok)
3337

python/layoutDD/loaders.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@ def saveFlatDXF(fpath):
88
tdoc = ezdxf.new()
99
importer = Importer(sdoc,tdoc)
1010
smsp= sdoc.modelspace()
11-
exploded=disassemble.recursive_decompose(smsp)
12-
importer.import_entities(exploded)
11+
tmsp= tdoc.modelspace()
12+
decomposed=disassemble.recursive_decompose(smsp)
13+
to_keep=["LINE","POINT","VERTEX","SPLINE","CIRCLE","ARC","ELLIPSE","POLYLINE","LWPOLYLINE"]
14+
to_explode=["POLYLINE","LWPOLYLINE"]
15+
for entity in decomposed:
16+
if entity.dxftype() in to_keep:
17+
importer.import_entity(entity)
18+
for entity in tmsp:
19+
if entity.dxftype() in to_explode:
20+
entity.explode()
21+
22+
# importer.import_entities(decomposed)
1323
tdoc.saveas(fpath+"_flat.dxf")
1424

1525
def saveStack(stack_path,stack):
@@ -129,7 +139,7 @@ def openProject():
129139
cellView = layoutView.cellview(cellViewId)
130140
cellLayout= cellView.layout()
131141
if os.path.exists(partitionPath+".lyp"):
132-
cellView.load_layer_props(partitionPath+".lyp",cellViewId)
142+
layoutView.load_layer_props(partitionPath+".lyp",cellViewId)
133143

134144

135145

python/layoutDD/subdomains.py

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,11 @@ def interceptedLayer(layerName,cellName):
284284
if cellName not in globalVar.partition_stack:
285285
return False
286286
[prefix,z0,z1,op,order]=globalVar.stack[layerName]
287+
z0=float(z0)
288+
z1=float(z1)
287289
[cell_z0,cell_z1]=globalVar.partition_stack[cellName]
290+
cell_z0=float(cell_z0)
291+
cell_z1=float(cell_z1)
288292
return z0<=cell_z1 and z1>=cell_z0
289293

290294

@@ -625,7 +629,7 @@ def makeLayerFaces2(lname,FCclipShape,FClayerShape,FC_unit,db_unit,useAllClipPol
625629
else:
626630
slicedFace=[]
627631
layerFaces=[]
628-
shift=2/FC_unit #2 um
632+
shift=3/FC_unit #3 um
629633
for face in slicedFace:
630634
Pc=getPointInFace(face,shift)
631635
xc=Pc[0]*FC_unit/db_unit
@@ -785,8 +789,16 @@ def addHSurf(doc,profile):
785789
z1i=float(z1i)
786790
z0i=max(cell_z0,z0i)
787791
z1i=min(cell_z1,z1i)
792+
if opi=='vsurf' or opi=='hsurf':
793+
shapeType="surf"
794+
elif opi=='add' or opi=='ins':
795+
shapeType="solid"
796+
else:
797+
shapeType="solid"
788798
if z1i<z0i:
789799
continue
800+
if z1i==z0i and shapeType=="solid":
801+
continue
790802
if prefix:
791803
label=prefix+"_"+lname
792804
else:
@@ -885,12 +897,6 @@ def addHSurf(doc,profile):
885897
surf=addHSurf(FCdoc,wires)
886898
surf.Label = f'{lname}_surf'
887899
layerBody.addObject(surf)
888-
if opi=='vsurf' or opi=='hsurf':
889-
shapeType="surf"
890-
elif opi=='add' or opi=='ins':
891-
shapeType="solid"
892-
else:
893-
shapeType="solid"
894900
FCdoc.recompute()
895901
if opi=='ins' or opi=='cut' and shapeType=="solid":
896902
tool=None
@@ -1036,16 +1042,16 @@ def extractSubdomainDXF(cellName,layoutView,dxf_unit):
10361042
for entity in msp:
10371043
if not entity.dxf.hasattr("layer"):
10381044
continue
1039-
if interceptedLayer(entity.dxf.layer,cell.name):
1040-
interceptedLayers.add(entity.dxf.layer)
1041-
if entity.dxftype() in extractedTypes:
1042-
bb = bbox.extents([entity])
1043-
ll=bb.extmin
1044-
ur=bb.extmax
1045-
kbb= pya.Box(ll[0]*dxf_unit/dbu,ll[1]*dxf_unit/dbu,ur[0]*dxf_unit/dbu,ur[1]*dxf_unit/dbu)
1046-
touchPoly=[poly for poly in cellShape.each_touching(kbb)]
1047-
if len(touchPoly)>0:
1048-
exporter.write(entity)
1045+
if entity.dxftype() in extractedTypes:
1046+
if interceptedLayer(entity.dxf.layer,cell.name):
1047+
interceptedLayers.add(entity.dxf.layer)
1048+
bb = bbox.extents([entity])
1049+
ll=bb.extmin
1050+
ur=bb.extmax
1051+
kbb= pya.Box(ll[0]*dxf_unit/dbu,ll[1]*dxf_unit/dbu,ur[0]*dxf_unit/dbu,ur[1]*dxf_unit/dbu)
1052+
touchPoly=[poly for poly in cellShape.each_touching(kbb)]
1053+
if len(touchPoly)>0:
1054+
exporter.write(entity)
10491055
finally:
10501056
exporter.close()
10511057
mainDoc.close()

0 commit comments

Comments
 (0)