PDA

View Full Version : Point insertion from Rectangle-Nodes/Corners



matthew.barry591410
2011-07-29, 09:25 AM
I have 200 rectangles in a .dwg all on the same layer.
Can anyone tell me whether it's possible to get AutoCAD to insert a POINT on each NODE of all of the 200 rectangles (i.e. Will be 800 points inserted once finished)?

Not sure how else to explain it. i hope you understand!

obviously there's the long-hand option of _POINT command & clicking on the 800 corners of my rectangles, but i want something faster with less potential for human-error.

ideas?

cadtag
2011-07-29, 12:20 PM
You'll need some custom programming for that. Try asking in the LISP forum, and let them know what the entitiies are (lines or plines - since there's no RECTANGLE object). If they are the only thing on the layer(s), that will help accomplish the selection.

arshiel88
2011-07-30, 06:57 PM
Can you run a vba macro?

Try this.



Sub PointsOnCorners()
On Error Resume Next
Dim pl As AcadLWPolyline
Dim PlineSelSet As AcadSelectionSet
Set PlineSelSet = ThisDrawing.SelectionSets.Add("PLINESELECT")
If Err Then
Err.Clear
Set PlineSelSet = ThisDrawing.SelectionSets.Item("PLINESELECT")
End If

Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
FilterType(0) = 0
FilterData(0) = "LWPOLYLINE"
PlineSelSet.SelectOnScreen FilterType, FilterData
Dim Coord As Variant
Dim pt(0 To 2) As Double
For Each pl In PlineSelSet
Coord = pl.Coordinates
For i = 0 To UBound(Coord) Step 2
pt(0) = Coord(i)
pt(1) = Coord(i + 1)
pt(2) = pl.Elevation
ThisDrawing.ModelSpace.AddPoint pt
Next i
Next
PlineSelSet.Clear
End Sub