Skip to main content
13-Aquamarine
June 13, 2023
Solved

component Surface

  • June 13, 2023
  • 1 reply
  • 1853 views

In creo toolkit how to visit each component surface?

 

 

Best answer by RPN
extern ProError ProSolidBodySurfaceVisit (ProSolidBody *body, 
 ProSurfaceVisitAction visit_action, 
 ProAppData app_data); 
/* 
 Purpose: Visits surface in a body

 Input Arguments:
 body - body
 visit_action - action function
 app_data - application data.

 Output Arguments:

 Return Values:
 PRO_TK_NO_ERROR - Function is successful.
 PRO_TK_E_NOT_FOUND- There are no surfaces in specified body. 
 */

1 reply

RPN
RPN18-OpalAnswer
18-Opal
June 15, 2023
extern ProError ProSolidBodySurfaceVisit (ProSolidBody *body, 
 ProSurfaceVisitAction visit_action, 
 ProAppData app_data); 
/* 
 Purpose: Visits surface in a body

 Input Arguments:
 body - body
 visit_action - action function
 app_data - application data.

 Output Arguments:

 Return Values:
 PRO_TK_NO_ERROR - Function is successful.
 PRO_TK_E_NOT_FOUND- There are no surfaces in specified body. 
 */
Aravind9813-AquamarineAuthor
13-Aquamarine
June 15, 2023

Hi Sir. Thanks for your reply

 

I'm using Creo 3.0 'ProSolidBodySurface' is not available, so I use 'ProSolidSurfaceVisit' but i don't get any value.

my query is I wanna visit each ASM component then i want to visit each component surface.

 

for visiting each ASM component i use 'ProSolidDispCompVisit' is this correct or else i need to add any API call?

 

RPN
18-Opal
June 15, 2023

At top level the component/feature ID is the path. Next you need to use ProAsmcomppathMdlGet(path in, model out). This model handle can be used to get all surface ids.

 

#

# Tcl code

# syncronous mode with an active assembly

#

foreach FID [ps_visit type COMPONENT] {
  set Model [ps_assy component $FID]
  set SurfIDs [ps_visit surfaces $Model]

# Now SurfIDs will contain a list of all surface IDs in Model

}

 

Note: If the component model is an assembly you may call the function recursive, because an assembly may not contain surfaces! And take care about the feature status.