Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Weblink Chose PNT in ModelTree

Gravecat

New member
Dear All,


I need to write a program to let user chosepoint to insert UDF. I use pfcSelectionOptions.Create(point) to limit user select point. But I find out that user can only select Point in the 3D model .The user can not select point in the model tree. How to let user select the point in the model tree and Webllink can access the point data?
 
It is not that proe only allows selection from 3D model. It is very much possible to make selection from feature tree.
ProToolkit allows it using ProSelect("feature",....) ,
here feature is the filter applied while making selection.Try applying filter this way and check results.

It appears that you have used API in correct way.

What actually happens when you go for selection?
 
Dear forstudy,


Because I use pfcBaseSession.select to let user select. What I write as following





var options = pfcCreate("pfcSelectionOptions").Create(selType);


var sels = oSession.Select(options, void null);





Then I use sels to create a UDF. If selType is "feature" I can select point in the Model Tree but I can not use it to create a UDF .So selType must be "point".





If I use "point", I can't select the point feature in the model tree. It looks like I chose other type feature. I think the point in the model tree is not real a "point".So Pro/Weblink can not access the data.


If I set selType="csys" , there is no problem.I can select a coordinate system in the Model Tree.
 
****If selType is "feature" I can select point in the Model Tree but I can not use it to create a UDF

What problem did you get when you try do that?
pfcSelection obejct will be filled and ready for use.
You can make sure it by converting it to model item.
ProToolkit has API ProSelectionModelitemGet(selectionObject,PointModelItem) , using this I was able to verify which point I have selected.
 
Hi,


I find out how to solve the problem.


var options = pfcCreate("pfcSelectionOptions").Create("feature");


var sels = oSession.Select(options, void null);





Then select the point in the model tree.Because the Selection's ModelItemlType is "feature",so I can't use this selection to create udf (you can chang pfcSelectioinOptions'ModelItemType to ITEM_POINT and select the point again,and you can find out the ModelItem's id changed.And only the ModelItemwhose typeis ITEM_POINT can be used to create udf, )


Then I need to use ModelItemlwhose typeis "feature" to find the real point, .Then I use ListSubItems(0) to find the sub ModelItem. Thesub ModelItem is the real point,the type of which isITEM_POINT. Then I use the class MpfcSelect to covert the ModelItem to a pfcSelection,which can be used to create udf.


Using this solution,I can select a multi point feature like Datum Point. Then use the points to create many UDFsat once .I think it's helpful for CAD users.
Edited by: Gravecat
 

Sponsor

Articles From 3DCAD World

Back
Top