Move existing text area in sketch

Move existing text area in sketch

info83PHN
Advocate Advocate
463 Views
1 Reply
Message 1 of 2

Move existing text area in sketch

info83PHN
Advocate
Advocate

I am looping thru the text areas in a sketch, and replacing the text with new values.

 

I would like to also be able to reposition the text area in the sketch ( will be conditional using an 'if' statement depending on the new text value )

 

How do I reposition / move the text area ?

 

	unitMgr: adsk.core.UnitsManager = design.unitsManager
	txt: adsk.fusion.SketchText

	values = [Ud1,Ud2,Ud3,Ud4,Ud5,Ud6]

	for txt, value in zip(skt1.sketchTexts, values[0:]):
		NewTxtValue = '------'
		if txt.text == 'DATA1': NewTxtValue = values[0]
		if txt.text == 'DATA2': NewTxtValue = values[1]

# now move the current active text area up on the Y axis +0.2

# ???
0 Likes
Accepted solutions (1)
464 Views
1 Reply
Reply (1)
Message 2 of 2

info83PHN
Advocate
Advocate
Accepted solution

got it. sharing for others.

 

            uMoveY = 0.2

            if uMoveY != 0:
                #create a collection of stuff to move
                coll = adsk.core.ObjectCollection.create()
                #add the current text area to the collection
                coll.add(txt)
                #create a transform
                transform = adsk.core.Matrix3D.create()
                transform.translation = adsk.core.Vector3D.create(0,uMoveY,0)
                #execute the move of the collection to the new position
                skt1.move(coll, transform)