Skip to main content
1-Visitor
Aug 6, 2018 4:04 AM UTC
Question

Using VB API to select CSYS

Dear 

 

Please help me example VB API in Creo

Create a button1 select CSYS in Creo then get name show in textbox1 in VB.

I want to create button in VB so select object in Creo, I had read ptc document but difficult for me to find example.

 

Thanks

This topic has been closed for replies.

5 replies

RPN
18-Opal
Aug 9, 2018 11:42 AM UTC

I couldn't resist, in Tcl I need this:

# Assume a 3D model is active, 
# and contains only one (to make the result clear) Csys with feature ID 11
# The Csys/Type/Geom ID off the Csys is 58
# No error checking in this code here

# Create Selection Object 'selObj' is the name of the object ps_sel selObj # Now ask the user to select a 'csys' (controls goes to Creo) selObj select csys # back from Creo, get the model item, note you selected a CSYS and not a FEATURE selObj modelitem miObj # Get the CSYS GeomID, after this command, GeomID will hold 58 set GeomID [miObj cget -id] # Get the Feature ID, after this command FeatID will hold the Value '11' set FeatID [ps_geom to_feat_ids CSYS $GeomID]

For the selection only, 2 lines of code Smiley Very Happy

 

Translate
1-Visitor
Sep 19, 2018 12:28 PM UTC

Dear Sir

 

Thanks your reply, I had follow your code but error.

I'm using Visual Basic 2016 Windows form Application not C# (I dont know)

I want to get name CSYS to textbox1

 

Thanks advance your help

Translate
RPN
18-Opal
Sep 19, 2018 1:02 PM UTC

That's simple, you have the model handel, and the feature ID, now you can get the feature name with this two references. In Tcl, working on the current model:

 

# Get the Feature Name
set FeatName [ps_feat name $FeatID]
Translate