|
|
@ -110,11 +110,11 @@ class TechDrawExtensions: |
|
|
|
parts_to_paint.append(part) |
|
|
|
parts_to_paint.append(part) |
|
|
|
|
|
|
|
|
|
|
|
# repaint parts that are new in this step (thick line) |
|
|
|
# repaint parts that are new in this step (thick line) |
|
|
|
|
|
|
|
prev_view = None |
|
|
|
if 'Assembly_handbook_PreviousStepView' in view.PropertiesList: |
|
|
|
if 'Assembly_handbook_PreviousStepView' in view.PropertiesList: |
|
|
|
prev_view = doc.getObject(view.Assembly_handbook_PreviousStepView) |
|
|
|
prev_view = doc.getObject(view.Assembly_handbook_PreviousStepView) |
|
|
|
if prev_view is not None: |
|
|
|
|
|
|
|
for part in view.XSource: |
|
|
|
for part in view.XSource: |
|
|
|
if part not in prev_view.XSource and part not in parts_to_paint: |
|
|
|
if (prev_view is None or part not in prev_view.XSource) and part not in parts_to_paint: |
|
|
|
parts_to_paint.append(part) |
|
|
|
parts_to_paint.append(part) |
|
|
|
|
|
|
|
|
|
|
|
# make sure the list is not empty, so that we reset all lines |
|
|
|
# make sure the list is not empty, so that we reset all lines |
|
|
@ -125,7 +125,7 @@ class TechDrawExtensions: |
|
|
|
default_line_thickness = 0.05 |
|
|
|
default_line_thickness = 0.05 |
|
|
|
line_thickness = default_line_thickness |
|
|
|
line_thickness = default_line_thickness |
|
|
|
|
|
|
|
|
|
|
|
default_color = (0.65, 0.65, 0.65) |
|
|
|
default_color = (0.5, 0.5, 0.5) |
|
|
|
color = default_color |
|
|
|
color = default_color |
|
|
|
|
|
|
|
|
|
|
|
if part is not None: |
|
|
|
if part is not None: |
|
|
@ -133,10 +133,7 @@ class TechDrawExtensions: |
|
|
|
|
|
|
|
|
|
|
|
center = self.computePartCenter(view, part) |
|
|
|
center = self.computePartCenter(view, part) |
|
|
|
|
|
|
|
|
|
|
|
if 'Assembly_handbook_PreviousStepView' in view.PropertiesList: |
|
|
|
if self.isNewPartInView(view, part): |
|
|
|
prev_view = doc.getObject(view.Assembly_handbook_PreviousStepView) |
|
|
|
|
|
|
|
if prev_view is not None: |
|
|
|
|
|
|
|
if not part in prev_view.XSource: |
|
|
|
|
|
|
|
line_thickness = 0.2 |
|
|
|
line_thickness = 0.2 |
|
|
|
color = (0, 0, 0) |
|
|
|
color = (0, 0, 0) |
|
|
|
|
|
|
|
|
|
|
@ -345,8 +342,15 @@ class TechDrawExtensions: |
|
|
|
balloon.BubbleShape = 'Inspection' |
|
|
|
balloon.BubbleShape = 'Inspection' |
|
|
|
balloon.EndTypeScale = 4 |
|
|
|
balloon.EndTypeScale = 4 |
|
|
|
|
|
|
|
|
|
|
|
def getPartDisplayName(self, obj): |
|
|
|
def isPartLink(self, obj): |
|
|
|
if obj.TypeId == 'App::Link': |
|
|
|
if obj.TypeId == 'App::Link': |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
if obj.TypeId == 'Part::FeaturePython' and hasattr(obj, 'LinkedObject'): # variant link |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
return False |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def getPartDisplayName(self, obj): |
|
|
|
|
|
|
|
if self.isPartLink(obj): |
|
|
|
linked_obj = obj.LinkedObject |
|
|
|
linked_obj = obj.LinkedObject |
|
|
|
if 'Assembly_handbook_PartDisplayName' in linked_obj.PropertiesList: |
|
|
|
if 'Assembly_handbook_PartDisplayName' in linked_obj.PropertiesList: |
|
|
|
return linked_obj.Assembly_handbook_PartDisplayName |
|
|
|
return linked_obj.Assembly_handbook_PartDisplayName |
|
|
@ -356,9 +360,13 @@ class TechDrawExtensions: |
|
|
|
|
|
|
|
|
|
|
|
def isNewPartInView(self, view, obj): |
|
|
|
def isNewPartInView(self, view, obj): |
|
|
|
doc = view.Document |
|
|
|
doc = view.Document |
|
|
|
|
|
|
|
prev_view = None |
|
|
|
if 'Assembly_handbook_PreviousStepView' in view.PropertiesList: |
|
|
|
if 'Assembly_handbook_PreviousStepView' in view.PropertiesList: |
|
|
|
prev_view = doc.getObject(view.Assembly_handbook_PreviousStepView) |
|
|
|
prev_view = doc.getObject(view.Assembly_handbook_PreviousStepView) |
|
|
|
if prev_view is not None: |
|
|
|
|
|
|
|
|
|
|
|
if prev_view is None: |
|
|
|
|
|
|
|
return True |
|
|
|
|
|
|
|
else: |
|
|
|
if not obj in prev_view.XSource: |
|
|
|
if not obj in prev_view.XSource: |
|
|
|
return True |
|
|
|
return True |
|
|
|
return False |
|
|
|
return False |
|
|
@ -421,7 +429,7 @@ class TechDrawExtensions: |
|
|
|
objectCenterWorld = partLink.LinkPlacement.Matrix.multiply(partLink.LinkedObject.Shape.CenterOfGravity) |
|
|
|
objectCenterWorld = partLink.LinkPlacement.Matrix.multiply(partLink.LinkedObject.Shape.CenterOfGravity) |
|
|
|
elif obj.TypeId == 'Part::FeaturePython' and hasattr(obj, 'LinkedObject'): # variant link |
|
|
|
elif obj.TypeId == 'Part::FeaturePython' and hasattr(obj, 'LinkedObject'): # variant link |
|
|
|
partLink = obj |
|
|
|
partLink = obj |
|
|
|
objectCenterWorld = partLink.LinkedObject.Shape.CenterOfGravity |
|
|
|
objectCenterWorld = partLink.Placement.Matrix.multiply(partLink.LinkedObject.Shape.CenterOfGravity) |
|
|
|
else: |
|
|
|
else: |
|
|
|
objectCenterWorld = obj.Shape.CenterOfGravity |
|
|
|
objectCenterWorld = obj.Shape.CenterOfGravity |
|
|
|
|
|
|
|
|
|
|
|