TheSwamp
Code Red => VB(A) => Topic started by: ML on February 23, 2005, 05:40:17 PM
-
I can successfully create a Selection Set but I am trying to use the
Sset.Select acSelectionSetLast
To select the last entity inserted into my drawing, at the same time I would like to create a layer and place the inserted block onto that layer.
Any suggestions?
I appreciate it
Mark
-
Mark, This code works for me to get the last VISIBLE created object:
Dim ss As AcadSelectionSet
Set ss = ThisDrawing.PickfirstSelectionSet
ss.Select acSelectionSetLast
Debug.Print ss.Item(0).ObjectName
To get the last created object in modelspace, regardless of visibility:
Dim ent As AcadEntity
Set ent = ThisDrawing.ModelSpace.Item(ThisDrawing.ModelSpace.Count - 1)
Debug.Print ent.ObjectName
-
Hey Jeff,
I really appreciate your help. I am not totally sure that you understood my question or may be I phrased it wrong.
I wanted use Sset.Select acSelectionSetLast
acSelectionSetLast (according to the help screens) gets the last entity in the drawing and adds it to your selection set.
So, I wanted to grad the last inserted entity, then use VBA to place that entity on a specified layer.
That is really the code I am looking for, or an idea of how to make it happen.
Thanks again
Mark
-
Hey Jeff
With you code example, It looks like I figured it out:
Thank you
Mark
Dim ss As AcadSelectionSet
Set ss = ThisDrawing.PickfirstSelectionSet
ss.Select acSelectionSetLast
Select Case ss.Item(0).ObjectName
Case Is = "AcDbBlockReference"
ThisDrawing.Layers.Add ("Test")
ss.Item(0).Layer = ("Test")
End Select