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

Send objects to command when the command at runtime?

4 REPLIES 4
Reply
Message 1 of 5
chengshirui
257 Views, 4 Replies

Send objects to command when the command at runtime?

Send objects to command when the command at runtime
--ThisDrawing.SendCommand "pedit " & "(handent """ & _
curEnt.Handle & """) "--
it send a object to command ,how to send a array of objects
to command line?

thanks
4 REPLIES 4
Message 2 of 5
DavideBrizio
in reply to: chengshirui

Actually, u don't send an object to the command line, but a string property of this object. The command line can only receive strings. What do u mean with array of objects? What do u want to send?
In your example, if curEnt() is an array, u can write

For i = 0 to ubound(curEnt)-1

ThisDrawing.SendCommand "pedit " & "(handent """ & _
curEnt(i).Handle & """) "--
Next

Does it help?

Dave
Message 3 of 5
Anonymous
in reply to: chengshirui

you can also use the SelectionSet
Message 4 of 5
chengshirui
in reply to: chengshirui

thank you for helping,I want to join plines ,how to use the SelectionSet from pedit command?
Message 5 of 5
Anonymous
in reply to: chengshirui

' Here is a simple code
' Make sure you select at least 2 polylines
' these polylines should be able to be joined as "_pedit" requires
' Good luck
' abbassisaid@yahoo.fr

Public Sub BreakLine()
Dim SSet As AcadSelectionSet
Dim sAllSelection As String

For i = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets(i).Name = "SSET" Then
ThisDrawing.SelectionSets(i).Delete
Exit For
End If
Next
Set SSet = ThisDrawing.SelectionSets.Add("SSET")
SSet.SelectOnScreen

For i = 0 To SSet.Count - 1
If SSet(i).ObjectName = "AcDbPolyline" Then
sAllSelection = sAllSelection & "(handent " & Chr(34) & SSet(i).Handle & Chr(34) & ")" & vbCr
If i = 0 Then sAllSelection = sAllSelection & "j" & vbCr
End If
Next i
ThisDrawing.SendCommand "_pedit" & vbCr & sAllSelection & vbCr & vbCr

End Sub

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

Post to forums  

Autodesk Design & Make Report

”Boost