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.
status = ProElementAlloc(PRO_E_STD_SURF_COLLECTION_APPL, &objElementSrfCollection);
status = ProSrfcollectionAlloc(&objSrfCollection);
status = ProSrfcollinstrAlloc(PRO_SURFCOLL_SINGLE_SURF, PRO_B_TRUE, &objSurfCollectInstruction);
status = ProSrfcollinstrIncludeSet(objSurfCollectInstruction, PRO_B_TRUE);
for (int i = 0; i < vectReferenceOfSurfaces.size(); ++i)
status = ProSrfcollrefAlloc(PRO_SURFCOLL_REF_SINGLE, vectReferenceOfSurfaces[i], &objSurfCollectRef);
status = ProSrfcollinstrReferenceAdd(objSurfCollectInstruction, objSurfCollectRef);
status = ProSrfcollectionInstructionAdd(objSrfCollection, objSurfCollectInstruction);
status = ProElementCollectionSet(objElementSrfCollection, objSrfCollection);
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.
Solved! Go to Solution.
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 )
Now it depends on IsMultival what you can use, if yes you can use ProElementReferencesSet() if number > 0 else you should use ProElementReferenceSet()
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.
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.
I would create the feature, and dump the result. Maybe the surface are stored in an array.
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.