Selecting and using pedit
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Selecting and using pedit

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
cmedinag
Guest





Posted: Mon Apr 04, 2005 11:13 pm    Post subject: Selecting and using pedit Reply with quote

Hi, i want to select different entities in square (the entities are all connected) and then join them into a polylyne using pedit/multiple/join... how do i manage to use the selected items for pedit?
thks!

Back to top
Paul Richardson
Guest





Posted: Mon Apr 04, 2005 11:28 pm    Post subject: Re: Selecting and using pedit Reply with quote

you didn't give up on coding your own did you? here is a sample
I use to join 4 lines. Might help you start, or seems like it just
might work as is.

If your going to script it use LISP and call from your VBA code.
I posed the bubble sort a few months ago. Let me know if you cannot find it.

gl
Paul

'<code>
'accepts 4 lines, adjust as necessary
Public Function pPlineJoin(vrLines) As AcadLWPolyline
Dim i As Integer
Dim entGen As AcadEntity
Dim objLine As AcadLine
Dim objLTPline As AcadLWPolyline

Dim XP(7)
Dim YP(7)
Dim P(9) As Double

On Error GoTo pPlineJoin_Error

For i = 0 To 3
Set objLine = vrLines(i)
XP(i) = objLine.StartPoint(0)
XP(7 - i) = objLine.EndPoint(0)

YP(i) = objLine.StartPoint(1)
YP(7 - i) = objLine.EndPoint(1)
Next i
'do a search for bubble sort function
BubbleSortVariantArray XP
BubbleSortVariantArray YP

P(0) = XP(0): P(1) = YP(0)
P(2) = XP(7): P(3) = YP(0)
P(4) = XP(7): P(5) = YP(7)
P(6) = XP(0): P(7) = YP(7)
P(8) = XP(0): P(9) = YP(0)

Set objLTPline = ThisDrawing.ModelSpace. _
AddLightWeightPolyline(P)
Set pPlineJoin = objLTPline

'I use original lines, delete if you need to

End Function
'<code/>

"cmedinag" <nospam@address.withheld> wrote in message
news:27038565.1112642028072.JavaMail.jive@jiveforum1.autodesk.com...
Quote:
Hi, i want to select different entities in square (the entities are all
connected) and then join them into a polylyne using pedit/multiple/join...
how do i manage to use the selected items for pedit?
thks!
Back to top
Paul Richardson
Guest





Posted: Tue Apr 05, 2005 12:47 am    Post subject: Re: Selecting and using pedit Reply with quote

http://www.cadresource.com/library/lispdk.html
Check out this lisp "jpoly.lsp"

For below code
Quote:
Dim entGen As AcadEntity
don't need
On Error GoTo pPlineJoin_Error
remove, or add handler.


"Paul Richardson" <noSPAM@nospam.com> wrote in message
news:4251954f$1_2@newsprd01...
Quote:
you didn't give up on coding your own did you? here is a sample
I use to join 4 lines. Might help you start, or seems like it just
might work as is.

If your going to script it use LISP and call from your VBA code.
I posed the bubble sort a few months ago. Let me know if you cannot find
it.

gl
Paul

'<code
'accepts 4 lines, adjust as necessary
Public Function pPlineJoin(vrLines) As AcadLWPolyline
Dim i As Integer
Dim entGen As AcadEntity
Dim objLine As AcadLine
Dim objLTPline As AcadLWPolyline

Dim XP(7)
Dim YP(7)
Dim P(9) As Double

On Error GoTo pPlineJoin_Error

For i = 0 To 3
Set objLine = vrLines(i)
XP(i) = objLine.StartPoint(0)
XP(7 - i) = objLine.EndPoint(0)

YP(i) = objLine.StartPoint(1)
YP(7 - i) = objLine.EndPoint(1)
Next i
'do a search for bubble sort function
BubbleSortVariantArray XP
BubbleSortVariantArray YP

P(0) = XP(0): P(1) = YP(0)
P(2) = XP(7): P(3) = YP(0)
P(4) = XP(7): P(5) = YP(7)
P(6) = XP(0): P(7) = YP(7)
P(8) = XP(0): P(9) = YP(0)

Set objLTPline = ThisDrawing.ModelSpace. _
AddLightWeightPolyline(P)
Set pPlineJoin = objLTPline

'I use original lines, delete if you need to

End Function
'<code/

"cmedinag" <nospam@address.withheld> wrote in message
news:27038565.1112642028072.JavaMail.jive@jiveforum1.autodesk.com...
Hi, i want to select different entities in square (the entities are all
connected) and then join them into a polylyne using
pedit/multiple/join... how do i manage to use the selected items for
pedit?
thks!



Back to top
Paul Richardson
Guest





Posted: Tue Apr 05, 2005 2:52 am    Post subject: Re: Selecting and using pedit Reply with quote

Quote:
Public Function pPlineJoin(vrLines) As AcadLWPolyline
should be (ByVal vrLines) since I don't want to

change my lines. Leave as is if you plan to delete in the
function. Or add ByRef explicitly.
"Paul Richardson" <noSPAM@nospam.com> wrote in message
news:4251a7b4_3@newsprd01...
Quote:
http://www.cadresource.com/library/lispdk.html
Check out this lisp "jpoly.lsp"

For below code
Dim entGen As AcadEntity
don't need
On Error GoTo pPlineJoin_Error
remove, or add handler.

"Paul Richardson" <noSPAM@nospam.com> wrote in message
news:4251954f$1_2@newsprd01...
you didn't give up on coding your own did you? here is a sample
I use to join 4 lines. Might help you start, or seems like it just
might work as is.

If your going to script it use LISP and call from your VBA code.
I posed the bubble sort a few months ago. Let me know if you cannot find
it.

gl
Paul

'<code
'accepts 4 lines, adjust as necessary
Public Function pPlineJoin(vrLines) As AcadLWPolyline
Dim i As Integer
Dim entGen As AcadEntity
Dim objLine As AcadLine
Dim objLTPline As AcadLWPolyline

Dim XP(7)
Dim YP(7)
Dim P(9) As Double

On Error GoTo pPlineJoin_Error

For i = 0 To 3
Set objLine = vrLines(i)
XP(i) = objLine.StartPoint(0)
XP(7 - i) = objLine.EndPoint(0)

YP(i) = objLine.StartPoint(1)
YP(7 - i) = objLine.EndPoint(1)
Next i
'do a search for bubble sort function
BubbleSortVariantArray XP
BubbleSortVariantArray YP

P(0) = XP(0): P(1) = YP(0)
P(2) = XP(7): P(3) = YP(0)
P(4) = XP(7): P(5) = YP(7)
P(6) = XP(0): P(7) = YP(7)
P(8) = XP(0): P(9) = YP(0)

Set objLTPline = ThisDrawing.ModelSpace. _
AddLightWeightPolyline(P)
Set pPlineJoin = objLTPline

'I use original lines, delete if you need to

End Function
'<code/

"cmedinag" <nospam@address.withheld> wrote in message
news:27038565.1112642028072.JavaMail.jive@jiveforum1.autodesk.com...
Hi, i want to select different entities in square (the entities are all
connected) and then join them into a polylyne using
pedit/multiple/join... how do i manage to use the selected items for
pedit?
thks!



Back to top
cmedinag
Guest





Posted: Tue Apr 05, 2005 7:43 pm    Post subject: Re: Selecting and using pedit Reply with quote

thanks for the help, now the thing is, im using not only lines, im using all kinds of entities, mostly arcs. I have already a function that joins the lines, but only if they are polylines... i need to do it with all kind of entities because i always get the error type missmatch... thats why i thinked about the pedit with multiple.... cuase the other way i will always need to use polylines right?
Back to top
Paul Richardson
Guest





Posted: Tue Apr 05, 2005 8:13 pm    Post subject: Re: Selecting and using pedit Reply with quote

For each obj in yourselset 'or whatever
If typeof obj is AcadLWPolyline Then
do this stuff 'or call this function
Elseif typeof of is...
do this stuff
Else: do other.
End if
Next obj

Or use a Case Structure..

Select Case TypeOf obj
Case AcadLWPolyline
do
Case....
do
Else: do other.
End Select



"cmedinag" <nospam@address.withheld> wrote in message
news:19347864.1112715815790.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
thanks for the help, now the thing is, im using not only lines, im using
all kinds of entities, mostly arcs. I have already a function that joins
the lines, but only if they are polylines... i need to do it with all kind
of entities because i always get the error type missmatch... thats why i
thinked about the pedit with multiple.... cuase the other way i will
always need to use polylines right?
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB