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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

PRO_E_CRV_IP_REF1 element for curve type feature creation using toolkit

Ketan_Lalcheta
19-Tanzanite

PRO_E_CRV_IP_REF1 element for curve type feature creation using toolkit

Hi

 

I am trying to create intersect feature using toolkit. This feature is created manually using datum plane and surfaces of extrude feature.

 

What I need to do for toolkit is to create feature of type PRO_FEAT_CURVE using in header file PRODTMCRV. Type should be Feature - Intersect Curve defined as PRO_CURVE_TYPE_INTSRF. While adding surfaces, I thought to have PRO_CURVE_TYPE_INTSRF as multiple selections of surfaces.

 

In case of single surface, I could have used API ProElementReferenceSet(), but what need to be done in case of multiple surfaces to be passed as value to this element.

 

I have used below code to set multiple surfaces into element called "PRO_E_CRV_IP_REF1 " , but it is not working properly.

 

ProElement objElementSrfCollection;

status = ProElementAlloc(PRO_E_STD_SURF_COLLECTION_APPL, &objElementSrfCollection);

ProCollection objSrfCollection;

 

status = ProSrfcollectionAlloc(&objSrfCollection);

ProSrfcollinstr objSurfCollectInstruction;

status = ProSrfcollinstrAlloc(PRO_SURFCOLL_SINGLE_SURF, PRO_B_TRUE, &objSurfCollectInstruction);

status = ProSrfcollinstrIncludeSet(objSurfCollectInstruction, PRO_B_TRUE);

for (int i = 0; i < vectReferenceOfSurfaces.size(); ++i)

 

{

ProSrfcollref objSurfCollectRef;

status = ProSrfcollrefAlloc(PRO_SURFCOLL_REF_SINGLE, vectReferenceOfSurfaces[i], &objSurfCollectRef);

 

status = ProSrfcollinstrReferenceAdd(objSurfCollectInstruction, objSurfCollectRef);

 

}

status = ProSrfcollectionInstructionAdd(objSrfCollection, objSurfCollectInstruction);

status = ProElementCollectionSet(objElementSrfCollection, objSrfCollection);

 

ProElement objElementIPRef1;

status = ProElementAlloc(PRO_E_CRV_IP_REF1, &objElementIPRef1);

status = ProElemtreeElementAdd(objElement_IPCompRef1, NULL, objElementIPRef1);

status = ProElemtreeElementAdd(objElementIPRef1, NULL, objElementSrfCollection);

 

 

Note: vectReferenceOfSurfaces is vector of ProReference for all required surfaces.

Any thought would be of great help.

 

Regards

Ketan

 

 

ACCEPTED SOLUTION

Accepted Solutions

You wrote: PRO_VALUE_TYPE_SELECTION (value_data.v.r = Reference) this seems old style of API to update element values.

 

Yes, but even if you use the new API, the result is the same.

 

 

You wrote: I am using API proelementrefenceset()

 

There is also a call to ProElementReferencesSet() !!! (This is Plural not singular ) Smiley Wink

 

Now it depends on IsMultival what you can use, if yes you can use ProElementReferencesSet() if number > 0 else you should use ProElementReferenceSet()

View solution in original post

18 REPLIES 18

Based on your modeling posts regarding the creation of intersection curves I am responding here. I am not a Toolkit expert.

If this Toolkit code is in the context of intersecting all solid surfaces of a model with a plane then I would suggest  looking for the function call that will select solid surfaces as an input to the intersection call. If there is not a call to select all solid surfaces then you may have to create a copy of solid surfs as I have shown in your other modeling thread.

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric

Hi

I am considering all surfaces of solid (I extrude) and datum plane... Hope this would not ask me to do copy paste... Manually also I have selected all surfaces with datum.

If Toolkit has the function to select solid surfs it should simplify the code for selection. See the pic below which shows how to select the solid geom which includes all surfaces of the geom pick in the graphics window.

 

Selection of slid surfaces for intersect featureSelection of slid surfaces for intersect feature

========================================
Involute Development, LLC
Consulting Engineers
Specialists in Creo Parametric

I am not allowing user to select surfaces... Through code only , I am considering one specific feature and gathering all surfaces of that feature...

I am not facing issue to select surfaces or consider surfaces...I am facing issue to set those surfaces within internal elements of element tree for intersect feature using toolkit.

I would create the feature, and dump the result. Maybe the surface are stored in an array.

Ketan_Lalcheta
19-Tanzanite
(To:RPN)

Hi

 

I have already exported element tree for a manually created feature. It is attached for your reference.

 

I could not get whether it's there in form of array or collection from extracted tree. Also for element tree, how to set up array elements. I could find and aware about only collection and section i.e. special value as value for element.

Share the model 0000000111.prt, is SurfID 102 the selected Datum?

Ketan_Lalcheta
19-Tanzanite
(To:RPN)

Hi

 

Attached is part for your reference.

 

CRV_IP_REF1 is a compound and is multival, containing a list/array of surface selections (The 2 cylindric surfaces).

CRV_IP_REF2 is a compound and is multival, containing only one surface (it is like it is), I was not able to select more than one (the datum)

 

.1 -type FEATURE_TYPE -map_integer CURVE
.2 -type CURVE_TYPE -integer 2
.3 -type STD_FEATURE_NAME -wstring 
.4 -type CRV_IP_REF_TYPE -integer 2
.5 -type CRV_IP_COMP_REF1 -compound 
.5.1 -type CRV_IP_REF1 -selection ::PS::FTREE::SEL.1 ::PS::FTREE::SEL.2
.5.2 -type CRV_IP_REF_SEL1_TYPE -integer 1
.6 -type CRV_IP_COMP_REF2 -compound 
.6.1 -type CRV_IP_REF2 -selection ::PS::FTREE::SEL.3
.6.2 -type CRV_IP_REF_SEL2_TYPE -integer 1
.7 -type CRV_IP_COMP_SEC1 -compound 

For a change add or replace the selection in the multi value area. I was able to add and redefine. An Elem may a compound, array or multival, you have functions to validate that property.

Ketan_Lalcheta
19-Tanzanite
(To:RPN)

Hi

 

This is correct. I had set 2 surfaces and hence it is giving two cylindrical surfaces.

 

If you see data type for CRV_IP_REF1 and CRV_IP_REF2, it is selection only. How one selection can hold two different surfaces is confusing me. Ideally one should be selection and one should be collection. with this, we can set one reference from selection (for datum) and other as collection of references (from selection to references for both the cylindrical surfaces).

In other words, CRV_IP_REF1 is of type selection and we need to use API ProElementReferenceSet() to set cylindrical surfaces....But how to set it two times for two different surfaces?

 

Thanks and Regards

Ketan

You wrote: How one selection can hold two different surfaces is confusing me.

 

This is not correct, the multivalue will hold an array of ProValue with the type PRO_VALUE_TYPE_SELECTION (value_data.v.r = Reference = ProSelection) as the values. Don't forget, this is even more complicated in assembly mode, where you have the comp path on top to validate.

 

 

Ketan_Lalcheta
19-Tanzanite
(To:RPN)

Hi

Thanks a lot for your help...

PRO_VALUE_TYPE_SELECTION (value_data.v.r = Reference) this seems old style of API to update element values.

What I am doing is setting element values with new API. For this, I am using API proelementrefenceset() rather than using old style of element value update for this specific element. There is no such api to set selection to element directly... So, I am converting selection to reference and then using api to set reference to element... Now more than one selection i.e. two selection object of surfaces can be stored in selection array.... But then how to convert selection array to reference is my concern... I am not able to set element value untill two selection objects are not converted to reference...

Any suggestion would be of great help.
P.s. : I am getting selection objects properly and I have verified that selection objects manually...

Maybe I'm wrong, but you have an array of values, and for each value you have your own selection structure.

 

You have only one model item in your selection, and not an array. So one selection can not reference two surfaces. This may true if you select a quilt, but this was not your question.

Ketan_Lalcheta
19-Tanzanite
(To:RPN)

Yes , you are correct... I don't have quilt.... I have two geomitem which I converted to two surfaces.... How to convert to surfaces in a single reference....

Because two references cannot be set using one API called proelementrefenceset (). This API ask for single reference object.

Do this mean to say that I must use API proelementrefenceset () for two different reference object (one for each selection object got from geom item of surface) for same element PRO_E_CRV_IP_REF1?

I am not sure whether plural API i.e. proelementrefencesset takes more than one references as input or not... I am not sure whether I did typo or there are two API or only one... I just wrote rough API name as I don't have access to documentation of toolkit...

If there is API which takes more than one references in a single go, I would definitely give a try tomorrow... If not, pleas suggest how to set two references through one API for single element .... Ideally it should take collection in such scenario but that is not the case...

I do appreciate your help on this issue. Thanks a lot.

There is a function available in the NEW API Smiley LOL

 

extern ProError ProSelectionarrayToReferences (ProSelection*  selections,
                                               ProReference** references);

 

This one should be good to go!

You wrote: PRO_VALUE_TYPE_SELECTION (value_data.v.r = Reference) this seems old style of API to update element values.

 

Yes, but even if you use the new API, the result is the same.

 

 

You wrote: I am using API proelementrefenceset()

 

There is also a call to ProElementReferencesSet() !!! (This is Plural not singular ) Smiley Wink

 

Now it depends on IsMultival what you can use, if yes you can use ProElementReferencesSet() if number > 0 else you should use ProElementReferenceSet()

Announcements


Top Tags