hi. jmperez6
Because it was an interesting theme, I challenged it.
I use temporary patch surfaces and projections.
Therefore, we will create a new sketch which is the outer circumference of the profile.
(Because there are not enough exception handling, it may cause an error.)
It is only parametric mode.
import adsk.core, adsk.fusion, traceback
_ui = None
def run(context):
try:
global _ui
app = adsk.core.Application.get()
_ui = app.userInterface
prod = app.activeProduct
#select Sketch
filters = 'Sketches'
sel = Sel('Select Sketch / ESC-Cancel', filters)
if sel is None:
return
sel_skt = sel.entity
refplane = sel_skt.referencePlane
#component
comp = prod.rootComponent
if sel_skt.assemblyContext != None:
comp = sel_skt.assemblyContext.component
#patch
profs = lst2objCollection(sel_skt.profiles)
patches = comp.features.patchFeatures
patchInput = patches.createInput(profs,
adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
tmp_patch = patches.add(patchInput)
#project
res_skt = comp.sketches.add(refplane)
[res_skt.project(face) for face in tmp_patch.faces]
#Sketch Remove Reference
curves = res_skt.sketchCurves
pros = ['sketchArcs',
'sketchCircles',
'sketchConicCurves',
'sketchEllipses',
'sketchEllipticalArcs',
'sketchFittedSplines',
'sketchFixedSplines',
'sketchLines']
for pro in pros:
[remove_ref(c) for c in eval('curves.' + pro)]
#Remove Temp Patch
tmp_patch.deleteMe()
_ui.messageBox('Done')
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
def lst2objCollection(lst):
ents = adsk.core.ObjectCollection.create()
for ent in lst:
ents.add(ent)
return ents
def remove_ref(skt_crv):
skt_crv.isReference = False
def Sel(msg, selFilter):
global _ui
try:
return _ui.selectEntity(msg, selFilter)
except:
return None