I need to Copy an IAcadLWPolyline and paste it right next to it.
I would like to hilight a group of drawing objects. But the hilight method makes the objects stand out less.
My idea is to define a Layer named HILITE with a bright yellow color and a thick line width. I would like to copy
certain objects and place them on the HILITE layer at the same place
So, I have a drawing with a number of IAcadLWPolyline (rectangles) on it.
I have a list of object handles which I can
use the HandleToObject method to 'grab' the object.
I want to copy this object over its exemplar and then assign it to the HILITE layer
IcadEnt = activeDoc.HandleToObject("3E")
If IcadEnt IsNot Nothing And IcadEnt.ObjectName = "AcDbPolyline" Then
dbmPL = CType(IcadEnt, IAcadLWPolyline)
' question 2 how do I get the X and Y or dbmPL?
Dim dbCopy As IAcadLWPolyline
dbCopy = dbmPL.Copy()
' question 1 what to do here
' is it something with activeDoc.ModelSpace ?
dbCopy.Layer = "HILITE"
End If
Comments
-
As far as I can see your code does what you set out to do: it creates a copy of an LWpolyline and places that copy on the HILITE layer.
I don't understand your questions ( in the comment within the code). Q1 "what do I do here?" A: nothing your done.
0 -
Ferdinand,
My apologies. My code wasn't working, and then while editing my question I removed some extraneous stuff. I didn't try the simplified code! Now I have and I see it does indeed work!
But one question I still have is how to find the basic X-Y placement of an item.
Thank you. Mark Bosley
0 -
But one question I still have is how to find the basic X-Y placement of an item.
You can use the GetBoundingBox method : ).
Daniel
0 -
..or if you want info on all the coordinates which make up the LWPolyLine you could use:
Function showInfo(ByVal inLWPoly As AcadLWPolyline) As String
Dim sBuf As String = "Info for AcadLWPolyline" & vbCrLf
sBuf = sBuf & "Handle= " & inLWPoly.Handle & vbCrLf
sBuf = sBuf & "Elevation= " & inLWPoly.Elevation & vbCrLf
sBuf = sBuf & "Closed= " & inLWPoly.Closed & vbCrLf
Dim iVertex As Integer = 0
Dim arrayVertices As System.Double() = inLWPoly.Coordinates
For i As Integer = 0 To arrayVertices.Length - 1 Step 2
iVertex = iVertex + 1
sBuf = sBuf & "vertex: " & iVertex & " x:" & arrayVertices(i) & " y:" & arrayVertices(i + 1) & vbCrLf
Next
Return sBuf
End Function0