Skip to content

Commit

Permalink
support Part::Compound in OpenSCADCommands.ExplodeGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
5263 authored and yorikvanhavre committed May 19, 2014
1 parent 941fc5c commit bff814b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Mod/OpenSCAD/OpenSCADCommands.py
Expand Up @@ -53,7 +53,9 @@ def randomcolor(transp=0.0):
return (random.random(),random.random(),random.random(),transp)

def explode(obj,color=True):
if obj.isDerivedFrom('Part::Fuse') or obj.isDerivedFrom('Part::MultiFuse'):
if obj.isDerivedFrom('Part::Fuse') or \
obj.isDerivedFrom('Part::MultiFuse') or \
obj.isDerivedFrom('Part::Compound'):
plm = obj.Placement
outlist = obj.OutList[:]
if plm.isNull() or all(len(oo.InList)==1 for oo in obj.OutList):
Expand Down
12 changes: 12 additions & 0 deletions src/Mod/OpenSCAD/exportDRAWEXE.py
Expand Up @@ -146,6 +146,18 @@ def process_object(csg,ob,filename):
d1['y']=f2s(ob.Normal.y)
d1['z']=f2s(ob.Normal.z)
csg.write('smirror %(name)s %(x)s %(y)s %(z)s %(dx)s %(dy)s %(dz)s\n' % d1)
elif ob.TypeId == 'Part::Compound':
if len(ob.Links) == 0:
pass
elif len(ob.Links) == 1:
process_object(csg,ob.Links[0],filename)
csg.write('tcopy %s %s\n'%(ob.Links[0].Name,d1['name']))
else:
basenames=[]
for i,subobj in enumerate(ob.Links):
process_object(csg,subobj,filename)
basenames.append(subobj.Name)
csg.write('compound %s %s\n' % (' '.join(basenames),ob.Name))
elif ob.TypeId in ["Part::MultiCommon", "Part::MultiFuse"]:
if len(ob.Shapes) == 0:
pass
Expand Down

0 comments on commit bff814b

Please sign in to comment.