Message 1 of 3

Not applicable
06-10-2016
04:02 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
My intent is to extrude sketch text. But when I add SketchText object to the new sketch I always get empty sketch.profiles collection. How can I provide a valid text-based profile to create ExtrudeFeatureInput object?
Fusion API Help indicates that Profiles class “also provides some additional utility functions to create open profiles and text based profiles that can be used as input for various features.” Where these functions are described?
Any code sample would be greatly appreciated.
Here is my test code that creates sketch text:
import adsk.core, adsk.fusion, traceback def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface design = app.activeProduct # Get the root component of the active design. rootComp = design.rootComponent # Create a new sketch on the xy plane. sketches = rootComp.sketches xyPlane = rootComp.xYConstructionPlane sketch = sketches.add(xyPlane) # Get sketch texts sketchTexts = sketch.sketchTexts # Create sketch text input point = adsk.core.Point3D.create(1.0, 1.0, 1.0) sketchTextInput = sketchTexts.createInput('example', 1.0, point) # Create sketch text sketchText = sketchTexts.add(sketchTextInput) m = sketch.sketchTexts.count n = sketch.profiles.count ui.messageBox("sketchTexts.count: %i \nprofiles .count: %i" % (m, n)) # # Create an extrusion input # extrudes = rootComp.features.extrudeFeatures # extInput = extrudes.createInput(profile, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) # distance = adsk.core.ValueInput.createByReal(0.1) # extInput.setDistanceExtent(False, distance) # extInput.isSolid = True # # # Create the extrusion # ext = extrudes.add(extInput) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
thanks
Solved! Go to Solution.