cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to create proselection object programatically?

SOLVED
lgangwar
Participant

How to create proselection object programatically?

I am trying to select 3D point this way.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to create proselection object programatically?

In Pro/Toolkit you can use ProSelectionAlloc. The second parameter is Promodelitem - your 3D point.

View solution in original post

14 REPLIES 14

Re: How to create proselection object programatically?

Which language / API ?

Re: How to create proselection object programatically?

I want to use PROTK API for making this happen. It is based on C language structure.

Re: How to create proselection object programatically?

In Pro/Toolkit you can use ProSelectionAlloc. The second parameter is Promodelitem - your 3D point.

View solution in original post

Re: How to create proselection object programatically?

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.

Re: How to create proselection object programatically?

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').

Re: How to create proselection object programatically?

I am making a point programatically (so don't have name or id of this point) and select it as a proselection() object programatically.

Re: How to create proselection object programatically?

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..

Re: How to create proselection object programatically?

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.


Re: How to create proselection object programatically?

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

Re: How to create proselection object programatically?

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

Re: How to create proselection object programatically?

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.

Re: How to create proselection object programatically?

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...

Re: How to create proselection object programatically?

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.

*/

Re: How to create proselection object programatically?

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.

Announcements