VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HELP Convert a lisp command to VBA line

0 REPLIES 0
Reply
Message 1 of 1
sub___zero
258 Views, 0 Replies

HELP Convert a lisp command to VBA line

Hi there,

i have a lisp code who working like this:

(setq	ss4 	(getpoint "\n Seleziona primo punto da tagliare:")
	ss5	(getpoint "\n Seleziona secondo punto da tagliare:")
	ss6	(getpoint "\n Seleziona terzo punto da tagliare:")
	ss7	(getpoint "\n Seleziona taglio:")
	ss8	(getpoint "\n Seleziona taglio:")
);setq
	(command "_pline" ss4 ss5 ss6 "")
	(command "_trim" ss4 "" "_f" ss7 ss8 "" "")

 thi part trin all poliline inside the poliline build with ss4-ss5-ss6 and point ss4-ss7-ss8 but I need to do the same work with VBA I write this but does not work:

'Linea taglio 1
Pnt1 = ThisDrawing.Utility.GetPoint(, "Linea di taglio 1")
Pnt2 = ThisDrawing.Utility.GetPoint(Pnt1, "Linea di taglio 2")
Pnt3 = ThisDrawing.Utility.GetPoint(Pnt2, "Linea di taglio 3")
poli_t(0) = Pnt1(0): poli_t(1) = Pnt1(1): poli_t(2) = Pnt1(2)
poli_t(3) = Pnt2(0): poli_t(4) = Pnt2(1): poli_t(5) = Pnt2(2)
poli_t(6) = Pnt3(0): poli_t(7) = Pnt3(1): poli_t(8) = Pnt3(2)

Set plineObj = ThisDrawing.ModelSpace.AddPolyline(poli_t)
plineObj.Layer = l_taglio
h_poli = CStr(plineObj.Handle)

Pnt4 = ThisDrawing.Utility.GetPoint(Pnt1, "Linea di taglio 4")
Pnt5 = ThisDrawing.Utility.GetPoint(Pnt4, "Linea di taglio 5")

Dim flags As Long
flags = ThisDrawing.GetVariable("OSMODE")
ThisDrawing.SetVariable "OSMODE", 0

h_p = CStr(ThisDrawing.ModelSpace(ent_iniziali + 1).Handle)
Debug.Print "h_p " & h_p

comString = "_TRIM" & vbCr & _
    Trasf_punto(Pnt1) & vbCr & vbCr & _
    "_F" & vbCr & vbCr & _
    Trasf_punto(Pnt4) & vbCr & _
    Trasf_punto(Pnt5) & vbCr & vbCr & vbCr

ThisDrawing.SendCommand comString

 wherer function Trasf_punto

 

'******************************************************************************
'Trasf_punto
'******************************************************************************
Private Function Trasf_punto(Pnt As Variant) As String
Dim str1 As String
Dim str2 As String

str1 = Replace(CStr(Pnt(0)), ",", ".")
str2 = Replace(CStr(Pnt(1)), ",", ".")

'Trasf_punto = "(LIST " & str1 & " " & str2 & " 0 )"
Trasf_punto = "( " & str1 & " " & str2 & " 0 )"

End Function

 can someone help me pls????

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost