Skip to content

Commit

Permalink
load bridge reference from svg
Browse files Browse the repository at this point in the history
  • Loading branch information
mnesarco committed Feb 22, 2023
1 parent 91a5320 commit d1fe842
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions freecad/marz/feature/import_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def extractCustomShape(filename, baseName, requireContour=True, requireMidline=T
contour = None
midline = None
transition = None
bridge = None
pockets = []

for obj in doc.Objects:
Expand All @@ -125,6 +126,8 @@ def extractCustomShape(filename, baseName, requireContour=True, requireMidline=T
midline = obj
elif obj.Name == 'transition':
transition = obj
elif obj.Name == 'bridge':
bridge = obj
else:
extractPocket(obj, pockets)

Expand Down Expand Up @@ -152,6 +155,12 @@ def extractCustomShape(filename, baseName, requireContour=True, requireMidline=T

anchor = anchor or Vector(0,0,0) # If no reference anchor

# Load Brifge reference
wbridge = None
if bridge:
wbridge = Part.Wire( bridge.Shape.copy().Edges )
wbridge.translate( -anchor )

# Find transition Segment
wtransition = None
if transition:
Expand Down Expand Up @@ -207,6 +216,9 @@ def merge(base, s):
if wtransition:
ui.addOrUpdatePart(wtransition, baseName + '_Transition', 'Transition', visibility=False, group=ui.UIGroup_Imports)

if wbridge:
ui.addOrUpdatePart(wbridge, baseName + '_Bridge', 'Bridge Reference', visibility=False, group=ui.UIGroup_Imports)

# Recalculate
if baseName == 'Marz_Headstock':
App.ActiveDocument.getObject(MarzInstrument_Name).Internal_HeadstockImport = int(time.time())
Expand Down

0 comments on commit d1fe842

Please sign in to comment.