Just wanting to know if its possible to select all elements on a specific layer and either add to or remove them from a select set.
The reason for asking is I want to modify my drawing border placement macro so that I can just replace certain parts of the border - for example the border text, logo or revision tables.
Solved! Go to Solution.
I've found a soultion that works pretty well.
By temporarily making a layer non-locatable it doesn't get added to the select set, so I do that before the copy, then again before I delete any existing border (not forgetting to ensure all layers are locatable afterwards)
For information though, I'd still like to know if there is an answer to my original question.
Sorry, I didn't see your post until I posted my own reply.
It's that looping through all elements in the select set and finding their layer that I'm not sure about.
Hi, Here's the piece of code I tested with:
Private Sub Button43_Click(sender As System.Object, e As System.EventArgs) Handles Button43.Click
Dim oApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("SolidEdge.Application")
Dim oDoc As SolidEdgeDraft.DraftDocument = oApp.ActiveDocument Dim oSet As SelectSet = Nothing oSet = oDoc.SelectSet oSet.AddAll() MessageBox.Show(oSet.Count.ToString) Dim o As Object = Nothing For i As Integer = oSet.Count To 1 Step -1 o = oSet.Item(i) If o.Layer.ToUpper <> "LayerName".ToUpper Then oSet.Remove(i) End If Next
MessageBox.Show(oSet.Count.ToString) End Sub
The loop that removes objects from the SelectSet is run in reverse order.
I could filter out all objects whose layer was named "LayerName".
What is your real name, if you don't mind ?
Thanks Tushar, I'll give that a try.
I prefer to remain annonymous if you don't mind.
I've been using that name for a good few years - originally on the Eng-Tips forum which I still vist from time-to-time.