Miguel Gala

Insert Sketchtext on selected line

Discussion created by Miguel Gala on Apr 8, 2020

Hi everyone

I am trying to do a PMP, at the moment I have managed to go through an array that inserts the texts that I want, but I am not able to put them on the selected lines in the selectionbox.


this is the code:



Private Sub PropertyManagerPage2Handler9_OnClose(ByVal Reason As Long)

Dim i As Integer

Dim strNombrePlano As String


If Reason = swPropertyManagerPageClose_Okay Then

'numero de repeticiones del bucle, será el número de lineas seleccionadas

intNum_Lineas = swSelMgr.GetSelectedObjectCount2(2)


Set swSketchPlane = swSelMgr.GetSelectedObject6(1, 1)

strNombrePlano = swSketchPlane.GetNameForSelection(swSelDATUMPLANES)

Debug.Print "Plano de Croquis: " & strNombrePlano


'Create Sketch from the first selectionbox selected plane

swModel.Extension.SelectByID2 strNombrePlano, "PLANE", 0, 0, 0, False, 0, Nothing, 0

swSketchMgr.InsertSketch True

swModel.ClearSelection2 True


For i = 1 To intNum_Lineas

Set swSketchSeg = swSelMgr.GetSelectedObject6(i, 2)

swModel.ClearSelection2 True


' Select the line (this have to be de second selection box wich contains the lines for every text)

boolstatus = swModelDocExt.SelectByID2("Línea1@Croquis1", "EXTSKETCHSEGMENT", _

0, 0, 0, False, 1, Nothing, 0)


'Insert the text on the selected line

swModel.InsertSketchText 0, 0, 0, i, 1, 0, 0, 100, 100

swModel.ClearSelection2 True



Next i


Debug.Print "Total Lineas: " & intNum_Lineas

'Debug.Print strSketchLine_name


swModel.InsertSketch2 True


End If 


Any suggestion?


Thank you