Community
I'm able to remove items from loftFeature.loftSections by:
Solved! Go to Solution.
Solved by kandennti. Go to Solution.
Hi @bjoern79de .
Using the attached file, I was able to process it like an image.
This is the source code.
#Fusion360API Python script
import adsk.core, adsk.fusion, traceback
_app = adsk.core.Application.cast(None)
_ui = adsk.core.UserInterface.cast(None)
def run(context):
try:
global _app, _ui
_app = adsk.core.Application.get()
_ui = _app.userInterface
des :adsk.fusion.Design = _app.activeProduct
root :adsk.fusion.Component = des.rootComponent
# get loft
loft = root.features.loftFeatures.item(0)
sects :adsk.fusion.LoftSections = loft.loftSections
# get insert profile
prof :adsk.fusion.Profile = root.sketches.item(2).profiles.item(0)
# backup markerPosition
tlPos :int = des.timeline.markerPosition
# change timeline before loft
des.timeline.markerPosition = loft.timelineObject.index
# get the last LoftSection
endSect :adsk.fusion.LoftSection = sects.item(sects.count - 1)
# backup the last entity
endEnt = endSect.entity
# change the last LoftSection entity
# LoftSection.entity was a read/write property
# https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-E0CE293E-9ED4-4E00-A5E6-32695A0F0A40
endSect.entity = prof
# add last entity backed up
sects.add(endEnt)
# Restore timeline
des.timeline.markerPosition = tlPos
except:
if _ui:
_ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Can't find what you're looking for? Ask the community or share your knowledge.