How to create proselection object programatically?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to create proselection object programatically?
I am trying to select 3D point this way.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
In Pro/Toolkit you can use ProSelectionAlloc. The second parameter is Promodelitem - your 3D point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Which language / API ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I want to use PROTK API for making this happen. It is based on C language structure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
In Pro/Toolkit you can use ProSelectionAlloc. The second parameter is Promodelitem - your 3D point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I want to use ProNoteAttachAddend() API for making leader line to my note. For this Proselection object is required. I am able to create ProSelection object but not able to set selected id and type correctly to my proselection object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
ProSelction object can be created by using the item name and item type.
Make ProModelItem object first (using 'ProModelitemByNameInit'), and then create ProSelection object (using 'ProSelectionAlloc').
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I am making a point programatically (so don't have name or id of this point) and select it as a proselection() object programatically.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How do you create the point programmatically? Could you post here a piece of code? It should be a modelitem, so you should be able to use it directly in ProSelectionAlloc..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
It is not model item. Can you help me to make a point model item. I want to code it like this.
ProPoint3d pPnt;
pPnt[0]=62.21;
pPnt[1]=-59.42;
pPnt[2]=-1.74;
than use this point to make proselection object.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can't create a point like this. If you want it selectable than it need to be a model item and this need to be inside Creo Features. The Only war I know is to create it as a feature.
Another way could be a mapkey. Thats no nice solution ... but sometimes the easiest way.
Br,
Eike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
hi I have no Code for a point atm, but in this Thread is some code for a Datum Plane:
"ProElemtreeElementAdd" does not work!
The creation is nearly same, just look wich element tree nodes you need. You could find them inside the API Documentation.
Br,
Eike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
All suggested methods are good and to the point. But in my case i got one API ProGeometryAtPointFind() works really well. This API should be used when you are certain that your 3D point will be on the part surface somewhere.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
This method will tell you surfaces or edges where the point lays on. I probably do not understand what are you exactly going to do...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
See i need model item to fill proselection object and i already know that the co-ordinates which i have they are on part. So by using this API "ProGeometryAtPointFind" i get the proselection object at that point directly. It creates proselection object on that part with appropriate data structure.
extern ProError ProGeometryAtPointFind ( ProPart part,
Pro3dPnt point,
ProSelection** p_sel_arr,
int* p_count);
/*
Purpose: Determines the surfaces or edges on which the specified
point is located. If a point lies on an edge, the function
does not return the neighboring surfaces.
Input Arguments:
part - The part handle.
point - A three-dimensional point, in the coordinates of the part.
Output Arguments:
p_sel_arr - An array of <I>ProSelection</I>, which has information
about surfaces or edges on which the point is located.
The function allocates space for this array; free it
using ProSelectionarrayFree().
p_count - The number of items on which the point lies.
Return Values:
PRO_TK_NO_ERROR - The function successfully evaluated the point.
PRO_TK_BAD_INPUTS - One or more of the input arguments are invalid.
PRO_TK_E_NOT_FOUND - The surface or edge was not found.
*/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, but ProSelection of surface or edge(s). I thought you need ProSeleciton of point. But it does not matter, if this is what you need, it is fine.