I have some component pattern (e.g. ILocalLinearPatternFeatureData, ILocalCircularPatternFeatureData; there are more).
I want to reference a certain component in that pattern in a way that I can
- determine if it currently exists based on the current instances in all possible dicrections;
- if it exists, get its IComponent2 object (in order to manipulate it).
That reference must be robust. That means: No matter how often I change the values of the instance dimensions, I should always get the component (if it exists).
Is there a way to do this?
To clarify:
Each component pattern is an IComponent2, and thus has a GetID(). The GetID() is generally a good way to reference components because it does not contain any data about the underlying file or the position in the feature tree or the component name or such. It never changes, so it is quite robust. But for pattern components it does not work: Modifying the values of the instance dimensions leads to REMOVAL and ADDING of components, depending on whether the instance value gets smaller or larger. So if we store the GetID() of some pattern component (e.g. value 116), then make the instance values smaller so that the component gets removed, then make the instance values larger, NEW components are added with NEW GetID()s. There is no guarantee that after that, a component of the same id (116) will exist; and even if a component of that id exists, there is no guarantee that is in the same position as the old one was before. So the GetID() just does not work here.
The property SkippedItemArray, which most component patterns have, suggests that internally each pattern component is referenced by coordinates (one or two):
As far as I can tell, the same coordinates always give the same position, no matter what the pattern component's GetID() is. So these coordinates would be the perfect reference for a pattern component. But: I could not find any API method that gives me a pattern component for given coordinates.
- Board index CAD SolidWorks API
- Search
-
- It is currently Mon Jun 03, 2024 8:35 am
- All times are UTC-04:00
Get pattern component based on its position/coordinates
Programming and macros
Get pattern component based on its position/coordinates
- Quote
- 0 login to like this post
Unread post by Kjara »
Jump to
- Welcome New Members
- ↳ Welcome
- ↳ Forum Rules
- CAD
- ↳ CAD Agnostic
- ↳ SolidWorks
- ↳ How To Questions
- ↳ SW General
- ↳ SolidWorks FAQ
- ↳ API
- ↳ Macro Library
- ↳ SolidWorks PDM
- ↳ 2D Drawings
- ↳ Routing-Electrical-Piping
- ↳ Surfacing
- ↳ Rendering - Visualize - Photoview
- ↳ SW Simulation
- ↳ SW Motion Analysis
- ↳ Enhancement Requests
- ↳ Solid Edge
- ↳ NX
- ↳ Onshape
- ↳ Creo
- ↳ Inventor
- ↳ Fusion 360
- ↳ KeyCreator
- ↳ Catia and 3DX
- ↳ IronCAD (CAXA)
- ↳ CAD Admin (Install, PDM, etc)
- ↳ subD and Mesh
- ↳ Hardware
- ↳ Misc CAD
- Other Technology
- ↳ Computer Aided Engineering
- ↳ Rendering and Motion
- ↳ 3D Scan
- ↳ General Engineering and Design
- ↳ AI and Related Tech
- Manufacturing
- ↳ 3D Print
- ↳ CAM
- ↳ Molding, Casting, Powder Metal
- ↳ Robotics
- Board Business
- ↳ General Biz and Announcements
- ↳ Suggestions
- ↳ What's Wrong?
- ↳ What's New
- ↳ Events
- ↳ Media and Advertising
- Off Topic
- ↳ Kitty Dump
- ↳ Job Listings
- ↳ For Sale and Want To Buy