Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
When working in the UI, I can add text to a Sketch, by dragging the text area.
Text in the text area can then be aligned center ( horizontally ) and aligned 'middle' ( vertically ).
This is very useful to center the text content on another item or rectangle.
In the API, I can create a box, create a circle, but the text seems to only have a starting point ( the bottom left point of the auto-sizing text area, depending on it's text content )
Is there a way to replicate the UI method of creating a specific size text box ?
# draw box1
uPointA = adsk.core.Point3D.create(uNextBoxX, uNextBoxY, 0)
uPointB = adsk.core.Point3D.create(uNextBoxX+uBoxW, uNextBoxY-uBoxH, 0)
sketch.sketchCurves.sketchLines.addTwoPointRectangle(uPointA, uPointB)
# draw circle1
circles = sketch.sketchCurves.sketchCircles
circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(uNextBoxX+uCircleX, uNextBoxY-uCircleY, 0), uCircleDiam*0.5)
# Create sketch text input starting point
uFont = "Segoe UI Semilight"
point = adsk.core.Point3D.create(uNextBoxX, uNextBoxY, 0)
sketchTexts = sketch.sketchTexts
sketchTextInput = sketchTexts.createInput("SAMPLE CODE", uTxHeight, point)
sketchTextInput.fontName = uFont
sketchText = sketchTexts.add(sketchTextInput)
Solved! Go to Solution.