PDA

View Full Version : Select all Objects inside a Polyline



avinash00002002
2006-03-23, 03:48 PM
I have somany closed polyline in this polyline I have some entities/objects/text. I want to get the program of all the objects are selected in the polyline in one pick like hatch




pixlepark96@sancharnet.in

Hammer.John.J
2006-03-23, 06:16 PM
when you are selecting you have the option to use "WP" which i think means window polygline

zoomharis
2006-03-24, 10:55 PM
Hi Avinash,

I have done some experiments on it and the program works works well in AutoCAD 2004. Just try the following code.



Sub selEntByPline()
On Error Resume Next
Dim objCadEnt As AcadEntity
Dim vrRetPnt As Variant
ThisDrawing.Utility.GetEntity objCadEnt, vrRetPnt
If objCadEnt.ObjectName = "AcDbPolyline" Then '|-- Checking for 2D Polylines --|
Dim objLWPline As AcadLWPolyline
Dim objSSet As AcadSelectionSet
Dim dblCurCords() As Double
Dim dblNewCords() As Double
Dim iMaxCurArr, iMaxNewArr As Integer
Dim iCurArrIdx, iNewArrIdx, iCnt As Integer
Set objLWPline = objCadEnt
dblCurCords = objLWPline.Coordinates '|-- The returned coordinates are 2D only --|
iMaxCurArr = UBound(dblCurCords)
If iMaxCurArr = 3 Then
ThisDrawing.Utility.Prompt "The selected polyline should have minimum 2 segments..."
Exit Sub
Else
'|-- The 2D Coordinates are insufficient to use in SelectByPolygon method --|
'|-- So convert those into 3D coordinates --|
iMaxNewArr = ((iMaxCurArr + 1) * 1.5) - 1 '|-- New array dimension
ReDim dblNewCords(iMaxNewArr) As Double
iCurArrIdx = 0: iCnt = 1
For iNewArrIdx = 0 To iMaxNewArr
If iCnt = 3 Then '|-- The z coordinate is set to 0 --|
dblNewCords(iNewArrIdx) = 0
iCnt = 1
Else
dblNewCords(iNewArrIdx) = dblCurCords(iCurArrIdx)
iCurArrIdx = iCurArrIdx + 1
iCnt = iCnt + 1
End If
Next
Set objSSet = ThisDrawing.SelectionSets.Add("SEL_ENT")
objSSet.SelectByPolygon acSelectionSetWindowPolygon, dblNewCords
objSSet.Highlight True
objSSet.Delete
End If
Else
ThisDrawing.Utility.Prompt "The selected object is not a 2D Polyline...."
End If
If Err.Number <> 0 Then
MsgBox Err.Description
Err.Clear
End If
End Sub

I hope it works. Please try to give me feedback so that we can make it better. I doubt that the program can be much shorter. But this is all i can do for now.

Happy Experiments.....
:)
har!s

avinash00002002
2006-03-25, 07:23 AM
Its great but I still want different type of program

We have a polygon but we don't select but only pick in an internl any point (Like hatch "Pick an Internal point")


Avinash Patil
pixlepark96@sancahrnet.in

zoomharis
2006-03-25, 07:43 AM
We have a polygon but we don't select but only pick in an internl any point (Like hatch "Pick an Internal point")

I don't know what difference that makes. The above program is just like using HATCH command with OBJECT option. Can you please tell me exactly why you need to pick an internal point...? I may be able to sort it out.

By the way, I don't care about the paths, I only care the destination.....

:)
har!s

avinash00002002
2006-03-25, 05:11 PM
Thanx for care

I need that I have a somany polylines in this polylines have somany text, I need to pick an Internal point so that every text in the polyline all the text are selected,


pixlepark96@sancharnet.in

bradlyferrell
2006-03-26, 05:15 PM
Thanx for care

I need that I have a somany polylines in this polylines have somany text, I need to pick an Internal point so that every text in the polyline all the text are selected,


pixlepark96@sancharnet.in

Hello Avinash,
What version of AutoCAD are you using?
And, are you wanting a VB/VBA program that allows you to choose all text within a closed polyline or just "some command" within Acad?

Hope we can help.

avinash00002002
2006-03-26, 06:43 PM
I am using AutoCAD 2006 and I waiting for your program

pixlepark96@sancharnet.in

kannan.vin681064
2015-10-21, 07:09 AM
what is the key to use this lisp
like we press bf for batch find?
I used appload and lisp was sucesssfully loaded and next step is
I have a huge drawing and i have drawn a polyline. Now I want to select all objects inside that polyline
Please Help