Skip to content

Commit

Permalink
Merge pull request #498 from 3x380V/fix_rename
Browse files Browse the repository at this point in the history
Fix AttachExtension::Support property rename
  • Loading branch information
Zolko-123 authored Jun 7, 2024
2 parents 88a131d + 37e9db8 commit 5141be2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
7 changes: 7 additions & 0 deletions Asm4_libs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ def cloneObject(obj):
result.Document.recompute()
return result

def newLCS(parent, objType, objName, attSupport):
result = parent.newObject(objType, objName)
if hasattr(result, 'AttachmentSupport'):
result.AttachmentSupport = attSupport
else:
result.Support = attSupport
return result

def placeObjectToLCS( attObj, attLink, attDoc, attLCS ):
expr = makeExpressionDatum( attLink, attDoc, attLCS )
Expand Down
5 changes: 4 additions & 1 deletion importDatumCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,10 @@ def Activated(self):
def setupTargetDatum(self, targetDatum, expression):
# unset Attachment
targetDatum.MapMode = 'Deactivated'
targetDatum.Support = None
if hasattr(targetDatum, 'AttachmentSupport'):
targetDatum.AttachmentSupport = None
else:
targetDatum.Support = None
# Set Asm4 properties
Asm4.makeAsmProperties( targetDatum, reset=True )
targetDatum.AttachedBy = 'Origin'
Expand Down
3 changes: 1 addition & 2 deletions mirrorPartCmd_obsolete.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def onOK(self):
# create Part
symPart = App.ActiveDocument.addObject( 'App::Part', symPartName )
# add an LCS at the root of the Part, and attach it to the 'Origin'
lcs = symPart.newObject('PartDesign::CoordinateSystem','LCS_'+symPart.Name)
lcs.Support = [(symPart.Origin.OriginFeatures[0],'')]
lcs = Asm4.newLCS(symPart, 'PartDesign::CoordinateSystem', 'LCS_'+symPart.Name, [(symPart.Origin.OriginFeatures[0],'')])
lcs.MapMode = 'ObjectXY'
lcs.MapReversed = False
# if there is a Parts group, put the symmetrical part there
Expand Down
3 changes: 1 addition & 2 deletions newAssemblyCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def Activated(self):
assembly.addProperty( 'App::PropertyString', 'AssemblyType', 'Assembly' )
assembly.AssemblyType = 'Part::Link'
# add an LCS at the root of the Model, and attach it to the 'Origin'
lcs0 = assembly.newObject('PartDesign::CoordinateSystem','LCS_Origin')
lcs0.Support = [(assembly.Origin.OriginFeatures[0],'')]
lcs0 = Asm4.newLCS(assembly, 'PartDesign::CoordinateSystem', 'LCS_Origin', [(assembly.Origin.OriginFeatures[0],'')])
lcs0.MapMode = 'ObjectXY'
lcs0.MapReversed = False
# set nice colors for the Origin planes
Expand Down
3 changes: 1 addition & 2 deletions newDatumCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ def Activated(self):
instanceNum = 1
while parentDoc.getObject( 'HoleAxis_'+str(instanceNum) ):
instanceNum += 1
axis = parentPart.newObject('PartDesign::Line','HoleAxis_'+str(instanceNum))
axis.Support = [( selectedObj, (edgeName,) )]
axis = Asm4.newLCS(parentPart, 'PartDesign::Line', 'HoleAxis_'+str(instanceNum), [( selectedObj, (edgeName,) )])
axis.MapMode = 'AxisOfCurvature'
axis.MapReversed = False
axis.ResizeMode = 'Manual'
Expand Down
3 changes: 1 addition & 2 deletions newPartCmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ def Activated(self):
# add stuff if appropriate (not for groups)
if self.partType in Asm4.containerTypes:
# add an LCS at the root of the Part, and attach it to the 'Origin'
lcs0 = newPart.newObject('PartDesign::CoordinateSystem','LCS_Origin')
lcs0.Support = [(newPart.Origin.OriginFeatures[0],'')]
lcs0 = Asm4.newLCS(newPart, 'PartDesign::CoordinateSystem', 'LCS_Origin', [(newPart.Origin.OriginFeatures[0],'')])
lcs0.MapMode = 'ObjectXY'
lcs0.MapReversed = False
# set nice colors for the Origin planes
Expand Down

0 comments on commit 5141be2

Please sign in to comment.