Skip to main content
1-Visitor
August 6, 2018
Question

Using VB API to select CSYS

  • August 6, 2018
  • 1 reply
  • 3612 views

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.

1 reply

RPN
18-Opal
August 9, 2018

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

 

1-Visitor
September 19, 2018

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

RPN
18-Opal
September 19, 2018

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]