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: 

Selecting Objects Using Geometry

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
philip.tuttleQLWHY
358 Views, 2 Replies

Selecting Objects Using Geometry

So here is the issue. I am setting up a set of braces at the bottom of an assembly but after all the the arrays are done I want to be able to be able to select ones that interfere with a feature I have put in on a different part. So lets say I have a box with an extrusion hole in it, when I run my iLogic to build an array of braces that cover the box completely in the pattern I want. Lets say I want to select and replace the ones that intersect with my extrusion feature in my box. I was looking at a way of making this a collection of objects using the name then doing a replace of those after. 

 

I kind of was looking at how i use my count command here and adding an and onto it to select them by using said feature. 

 

'Get the active assembly.
Dim oASMDOC As AssemblyDocument
oASMDOC = ThisApplication.ActiveDocument

' Get the assembly component definition.
Dim oASMDEF As AssemblyComponentDefinition
oASMDEF = oASMDOC.ComponentDefinition

Dim OA As ? = ?


Dim COUNT As ObjectCollection
COUNT = Components.Add()
Dim oOCC As ComponentOccurrence
For Each oOCC In oASMDEF.Occurrences
	If oOCC.Name.Contains("DTC") And OA?
		COUNT.Add
	End If
Next
Any help would be appreciated.

Thanks,

 

2 REPLIES 2
Message 2 of 3

It's kind of difficult to understand specifically what you are wanting, but It seems to me that you have defined a rectangular area within an assembly that you want to avoid with all components.  Then it seems you want to check which components intersect/interfere with that rectangular area, and add those components that do intersect/interfere to a collection.  Then it seems you want to either delete or replace those components within that collection.  Does that sound about right?

 

I have a couple of possible ideas for your project.  An ExtrudeFeature has a property called RangeBox, which returns a Box object (transient object).  ComponentOccurrences also have a RangeBox property.  This Box object has a couple of methods (Contains & IsDisjoint) for determining if either a Point is inside it, or if another Box intersects it.  You may be able to use these tools to help you determine if any of the components are intersecting your rectangular extrude feature.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

That is exactly what i am looking for! Thanks so much I will try this out.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report