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: 

Finding orphaned objects on a drawing

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
etckerry
1061 Views, 11 Replies

Finding orphaned objects on a drawing

Hello,

 

I'm working on a routine to find orphaned objects in .idw files.  So far, I've found it relatively simple to find orphaned dimensions, balloons, surface texture symbols and centerlines/marks, but I'm having trouble with leaders (such as for tapped holes, etc.) and weld symbols.

 

I've tried iterating through a drawing's SketchedSymbols collection, but it seems that this collection always has zero size, and unlike the items I've been successful with so far, I cannot find a specific collection for those items either within the sheet or drawingview objects.

 

Any advice?

 

Thanks,

 

Kerry

11 REPLIES 11
Message 2 of 12
mrattray
in reply to: etckerry

Have you tried using the HoleThreadNotes collection for hole and thread notes? There's also the LeaderNotes collection. I'm not sure how you could access weld notes, though. I've never had cause to.

Mike (not Matt) Rattray

Message 3 of 12
etckerry
in reply to: mrattray

Hello Mike,

 

How can I access the HoleThreadNotes collection?  It looks like a HoleThreadNote is a type of dimension, but when I iterate through the unattached dimensions on a sheet, it doesn't come up.  Maybe if I could access the collection directly it would be more helpful, but I don't see an obvious way to do this (it's not under the sheet or view objects).  Same issue for the LeaderNotes collection.

 

Thanks,

 

Kerry

Message 4 of 12
mrattray
in reply to: etckerry

Sheet.DrawingNotes.HoleThreadNotes

You'll also find under Sheet.DrawingNotes: LeaderNotes, BendNotes, ChamferNotes, GeneralNotes, and PunchNotes.
Mike (not Matt) Rattray

Message 5 of 12
etckerry
in reply to: mrattray

Thanks!  This gets me so much closer.

 

Now if there were a way to iterate through weld symbols I'd be all set...

 


-Kerry

Message 6 of 12
mslosar
in reply to: etckerry

So there's not even a method to simply select the existing weld symbols so you could do somethng like delete them?

 

If not, seems like a glaring oversight. I can see not exposing the guts of the weld symbol, but not being able to select or more them.

Message 7 of 12
etckerry
in reply to: etckerry

Seeing your reply made me take another look - it turns out the weld symbols are accessible through the Sheet.DrawingNotes.GeneralNotes interface.

 

I did a little experimenting just now, and I don't see a way to distinguish between weld symbols and normal leader notes, nor do I see methods for accessing properties specific to weld symbols or any way to see if these general notes have a leader.  I tried using the Type property and attribute sets, but the type is System._ComObject and the attribute sets are empty.

 

For my purposes, all I really need is a way to determine if the note has a leader and if the leader is attached to anything, but it would be nice to be able to differentiate between weld symbols and leader notes, too.

 

The general notes collections don't seem to include GDT symbols, either.

 

-Kerry

Message 8 of 12
mslosar
in reply to: etckerry

Well, this doesn't remove weld symbols

 

 Dim oLN As DrawingNote
    For Each oLN In oSheet.DrawingNotes.LeaderNotes
        oLN.Delete
    Next

 I'm building a tool to allow users to remove object types from drawings with a simple click. Wipe everything other than the views or pick a category(ies) to wipe.

 

I've been able to select everything and remove them except weld symbols. I can't seem to find a way to grab them. How were you able to get them selected?

Message 9 of 12
etckerry
in reply to: mslosar

Try this:

 

    Dim oGN As GeneralNote
    For Each oGN In oSheet.DrawingNotes.GeneralNotes
        oGN .Delete
    Next

 

-Kerry

Message 10 of 12
mslosar
in reply to: etckerry

That's almost literally what I already had 🙂

 

Dim oGN As DrawingNote
        For Each oGN In oSheet.DrawingNotes.GeneralNotes
            oGN.Delete
        Next

 it strips off general text for me, but not weld symbols. I'll give a shot a dim'ing it as a generalnote instead.

Message 11 of 12
etckerry
in reply to: etckerry

You're right - it's not iterating the weld symbols.  I swear I was able to iterate through them this morning, but for the life of me I cannot do it now Smiley Frustrated

 

If I figure out what I did, I'll post an example, otherwise I'll assume I was still half asleep and didn't know what I was doing.

 

-Kerry

Message 12 of 12
mslosar
in reply to: mslosar

Ran it that way and it still leaves weld notes on the drawings...

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

Post to forums  

Autodesk Design & Make Report