Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to highlight a Selection Set, (second try)

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
332 Views, 6 Replies

How to highlight a Selection Set, (second try)

Does anyone have a short example of how to programmatically highlight a
selection set?

Thanks,

Ed
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

Ed,

If you have objects in a selection set that means they are already
highlighted. I am a little confused here with what you are asking or trying
to do.

There is also a highlight set, if you are not aware:
PartDocument.HighlightSets.Add.AddItem

Cheers,
Thilak

"Ed Thompson" wrote in message
news:C553052E0BC23C410A39E2589AF7FC46@in.WebX.maYIadrTaRb...
> Does anyone have a short example of how to programmatically highlight a
> selection set?
>
> Thanks,
>
> Ed
>
>
Message 3 of 7
Anonymous
in reply to: Anonymous

Another question:

When I tried the following code:

The Selection set SS1 and the object have been previously defined.

Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

For Each oOcc In SS1
oAsmDoc.HighlightSets.Add.AddItem (oOcc)
Next

The error message resulted: "Object doesn't support this property or
message". Is this message a result of using an assembly, rather then a
part. I am trying to highlight parts in an assembly rather then features in
a part?

Thanks again!

Ed


"raot" wrote in message
news:CCE0F1F54258FF55593D4AE72C4054A4@in.WebX.maYIadrTaRb...
> Ed,
>
> If you have objects in a selection set that means they are already
> highlighted. I am a little confused here with what you are asking or
trying
> to do.
>
> There is also a highlight set, if you are not aware:
> PartDocument.HighlightSets.Add.AddItem
>
> Cheers,
> Thilak
>
> "Ed Thompson" wrote in message
> news:C553052E0BC23C410A39E2589AF7FC46@in.WebX.maYIadrTaRb...
> > Does anyone have a short example of how to programmatically highlight a
> > selection set?
> >
> > Thanks,
> >
> > Ed
> >
> >
>
>
Message 4 of 7
Anonymous
in reply to: Anonymous

Ed,

.SelectSet property is the current active selection. There is no
concept of having named selection sets as you see
in AutoCAD.

Your code worked fine for me provided I had declared SS1 globally.

Cheers,
Thilak


"Ed Thompson" wrote in message
news:F4279ABCE41A7D467AA2C3F66D79C034@in.WebX.maYIadrTaRb...
> Another question:
>
> When I tried the following code:
>
> The Selection set SS1 and the object have been previously defined.
>
> Dim oAsmDoc As AssemblyDocument
> Set oAsmDoc = ThisApplication.ActiveDocument
>
> For Each oOcc In SS1
> oAsmDoc.HighlightSets.Add.AddItem (oOcc)
> Next
>
> The error message resulted: "Object doesn't support this property or
> message". Is this message a result of using an assembly, rather then a
> part. I am trying to highlight parts in an assembly rather then features
in
> a part?
>
> Thanks again!
>
> Ed
>
>
> "raot" wrote in message
> news:CCE0F1F54258FF55593D4AE72C4054A4@in.WebX.maYIadrTaRb...
> > Ed,
> >
> > If you have objects in a selection set that means they are already
> > highlighted. I am a little confused here with what you are asking or
> trying
> > to do.
> >
> > There is also a highlight set, if you are not aware:
> > PartDocument.HighlightSets.Add.AddItem
> >
> > Cheers,
> > Thilak
> >
> > "Ed Thompson" wrote in message
> > news:C553052E0BC23C410A39E2589AF7FC46@in.WebX.maYIadrTaRb...
> > > Does anyone have a short example of how to programmatically highlight
a
> > > selection set?
> > >
> > > Thanks,
> > >
> > > Ed
> > >
> > >
> >
> >
>
>
Message 5 of 7
Anonymous
in reply to: Anonymous

Thilak,

With your help, I got this figured out- Thanks! If anyone else is
interested, the problem that created the error was with the line:
oAsmDoc.HighlightSets.Add.AddItem (oOcc) where the parentheses created the
error. And yes, the SS1 had been declaired globally. By declairing the
selection set globally, this basically mimics an ACAD selection set.

Something that I discovered was to clean up the screen and to get rid of the
highlight, the following line "cleaned up" the highlighted components:
oAsmDoc.Update

Something that I found interesting was that while the parts were highlighted
on the drawing, only one of the parts was highlighted in the browser,
(probably the last one in the selection set). Does anyone know why? Does
anyone know how to highlight the parts in the browser as well as on the
drawing?

Ed

"raot" wrote in message
news:CD130B19E7576F9754BB7A6C2379D4C4@in.WebX.maYIadrTaRb...
> Ed,
>
> .SelectSet property is the current active selection. There is no
> concept of having named selection sets as you see
> in AutoCAD.
>
> Your code worked fine for me provided I had declared SS1 globally.
>
> Cheers,
> Thilak
>
>
> "Ed Thompson" wrote in message
> news:F4279ABCE41A7D467AA2C3F66D79C034@in.WebX.maYIadrTaRb...
> > Another question:
> >
> > When I tried the following code:
> >
> > The Selection set SS1 and the object have been previously defined.
> >
> > Dim oAsmDoc As AssemblyDocument
> > Set oAsmDoc = ThisApplication.ActiveDocument
> >
> > For Each oOcc In SS1
> > oAsmDoc.HighlightSets.Add.AddItem (oOcc)
> > Next
> >
> > The error message resulted: "Object doesn't support this property or
> > message". Is this message a result of using an assembly, rather then a
> > part. I am trying to highlight parts in an assembly rather then
features
> in
> > a part?
> >
> > Thanks again!
> >
> > Ed
> >
> >
> > "raot" wrote in message
> > news:CCE0F1F54258FF55593D4AE72C4054A4@in.WebX.maYIadrTaRb...
> > > Ed,
> > >
> > > If you have objects in a selection set that means they are already
> > > highlighted. I am a little confused here with what you are asking or
> > trying
> > > to do.
> > >
> > > There is also a highlight set, if you are not aware:
> > > PartDocument.HighlightSets.Add.AddItem
> > >
> > > Cheers,
> > > Thilak
> > >
> > > "Ed Thompson" wrote in message
> > > news:C553052E0BC23C410A39E2589AF7FC46@in.WebX.maYIadrTaRb...
> > > > Does anyone have a short example of how to programmatically
highlight
> a
> > > > selection set?
> > > >
> > > > Thanks,
> > > >
> > > > Ed
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Message 6 of 7
Anonymous
in reply to: Anonymous

Thilak,

You are absolutely right about the parts being highlighted when they are
selected. However, I have a situation where after a selection set has been
selected and possibly manipulated that sometime later, (possibly after quite
a while) I would like to verify that the previously selection set is still
valid.

I did see the highlightsets, but had a lot of questions about its use.
Given the line of code that you provided I think that the selection set can
be cycled through and each component can be highlighted. Does the
HighlightSets do anything other then just highlight the components? Is it
necessary for the HighlightSet to be "nulled" or does it "vaporize" when the
routine is exited?

I really appreciat your responses!

Ed

"raot" wrote in message
news:CCE0F1F54258FF55593D4AE72C4054A4@in.WebX.maYIadrTaRb...
> Ed,
>
> If you have objects in a selection set that means they are already
> highlighted. I am a little confused here with what you are asking or
trying
> to do.
>
> There is also a highlight set, if you are not aware:
> PartDocument.HighlightSets.Add.AddItem
>
> Cheers,
> Thilak
>
> "Ed Thompson" wrote in message
> news:C553052E0BC23C410A39E2589AF7FC46@in.WebX.maYIadrTaRb...
> > Does anyone have a short example of how to programmatically highlight a
> > selection set?
> >
> > Thanks,
> >
> > Ed
> >
> >
>
>
Message 7 of 7
Anonymous
in reply to: Anonymous

Ed,

I don't know where to start and I don't understand it very clearly. So I
will share my knowledge in this area
and you grasp what you are looking for:

* SelectionSet is different from HighlightSet.
* All that is in a SelectionSet is highlighted by default.
* All that is highlighted need not necessarily be in the selectionset.
* If the scope of the highlightset is within the Sub then it would die the
moment the routine ends.
* If the variable is declared globally then the highlightset will exist
until nulled.
Sub test()

Dim part As PartDocument
Dim hs As HighlightSet

Set part = ThisDocument
MsgBox part.HighlightSets.Count

Set hs = part.HighlightSets.Add
hs.AddItem part.ComponentDefinition.SurfaceBodies(1).Faces(1)

End Sub

* The highlightset can only highlight objects with a color of your choice.

* One other thing worth mentioning is that the faces/edges etc., change for
every editing operation that you do.
For ex:
Consider a rectangular block and assume that you have a pointer to a certain
face (call it face1) on it. Add a hole by distance
on a completely different face and not face1. You would visually see that
face1 is still the same and you assume that it is still
pointing to it. Now if you try to use this pointer (face1) to create any
feature, it would err out. So what you have to do is to bring
the model back to a state when you obtained face1 (by moving 'End of Part')
OR
obtain a pointer to the desired face at the present state and then proceed.

The jist is that the topology changes for every editing operation no matter
whether you visually see the change or not.

Cheers,
Thilak



"Ed Thompson" wrote in message
news:CBDBD9FAC6EECF227F7E9E343E394B8D@in.WebX.maYIadrTaRb...
> Thilak,
>
> You are absolutely right about the parts being highlighted when they are
> selected. However, I have a situation where after a selection set has
been
> selected and possibly manipulated that sometime later, (possibly after
quite
> a while) I would like to verify that the previously selection set is still
> valid.
>
> I did see the highlightsets, but had a lot of questions about its use.
> Given the line of code that you provided I think that the selection set
can
> be cycled through and each component can be highlighted. Does the
> HighlightSets do anything other then just highlight the components? Is it
> necessary for the HighlightSet to be "nulled" or does it "vaporize" when
the
> routine is exited?
>
> I really appreciat your responses!
>
> Ed
>
> "raot" wrote in message
> news:CCE0F1F54258FF55593D4AE72C4054A4@in.WebX.maYIadrTaRb...
> > Ed,
> >
> > If you have objects in a selection set that means they are already
> > highlighted. I am a little confused here with what you are asking or
> trying
> > to do.
> >
> > There is also a highlight set, if you are not aware:
> > PartDocument.HighlightSets.Add.AddItem
> >
> > Cheers,
> > Thilak
> >
> > "Ed Thompson" wrote in message
> > news:C553052E0BC23C410A39E2589AF7FC46@in.WebX.maYIadrTaRb...
> > > Does anyone have a short example of how to programmatically highlight
a
> > > selection set?
> > >
> > > Thanks,
> > >
> > > Ed
> > >
> > >
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report