
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi every body .. this forum is really help to me ... i have been learning a lot from this forum. thankyou soo much for all you help...!
i need help in highlighting a feature in an occurrence....
here is the code i am using... design file is attached below... keep the code and design file in the same directory... i want to highlight a feature named 'hole' ...
import adsk.core, adsk.fusion, traceback
import os.path, sys
numberOfTeeths = 25
internalDia = 10
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
# Get import manager
importManager = app.importManager
# Get active design
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
# Get root component
rootComp = design.rootComponent
# Get archive import options and importing files
archiveFileName = os.path.join(os.path.dirname(os.path.realpath(__file__)), '1.f3d')
archiveOptions = importManager.createFusionArchiveImportOptions(archiveFileName)
#getting occurence
importManager.importToTarget(archiveOptions, rootComp)
pulleyOccurrence = rootComp.occurrences.item(rootComp.occurrences.count-1)
parametersList = pulleyOccurrence.component.parentDesign.allParameters
numberOfTeethspara = parametersList.itemByName('nt')
InternalDiapara = parametersList.itemByName('id')
numberOfTeethspara.expression = str(numberOfTeeths)
InternalDiapara.expression = str(internalDia)
pulleyComponent = pulleyOccurrence.component
holeFeature = pulleyComponent.features.extrudeFeatures.itemByName('hole')
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.