() |
# Purpose : This file provides an example of a call to the
# function neutold_import_neutral()
#
# This session file will open a existing database
# ’plate.db’ and will export it to Neutral format
# database by name plate_neutral.out.1. The same
# file will be imported to demonstrate the effect
# of the function.
#
# Before running this session file run plate.ses
# to create plate.db
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function neutold_import_neutral()
# has the following arguments:
#
# neutold_import_neutral
# ( file_name,
# group_name,
# entity_toggle_flags,
# minimum_id,
# maximum_id,
# offset )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_group_name[32]
LOGICAL la_entity_toggle_flags(35)
INTEGER ia_minimum_id(35)
INTEGER ia_maximum_id(35)
INTEGER ia_offset(35)
INTEGER i_return_value
STRING s_title[64]
LOGICAL l_all_groups
INTEGER i_number_of_groups
INTEGER ia_group_entity_ids(4)
#---------------------------------------------------------------------
# Open the database "plate.db"
uil_file_open.go("plate.db")
#---------------------------------------------------------------------
# Exporting following entity types to the file ’plate_neutral.out.1’
# Entity types - Nodes, Elements, Material, Element Properties
la_entity_toggle_flags(1) = TRUE
la_entity_toggle_flags(2) = TRUE
la_entity_toggle_flags(3) = TRUE
la_entity_toggle_flags(4) = TRUE
s_file_name = "plate_neutral.out"
s_title = "File created by exporting Patran database"
l_all_groups = FALSE
i_number_of_groups = 1
ia_group_entity_ids = [1, 0, 0, 0]
#
i_return_value = @
neutral_export2 @
( s_file_name, @
s_title, @
la_entity_toggle_flags, @
l_all_groups, @
i_number_of_groups, @
ia_group_entity_ids )
dump i_return_value
# Closing the current database ’plate.db’.
uil_file_close.go( )
#---------------------------------------------------------------------
# Opening a new database by name ’new.db’.
uil_file_new.go( "", "new.db" )
$? YES 36000002
#---------------------------------------------------------------------
# Importing the file with all entities in default_group.
s_file_name = "plate_neutral.out.1"
s_group_name = "default_group"
ia_offset(1) = 3
ia_offset(2) = 7
#
i_return_value = @
neutold_import_neutral @
( s_file_name, @
s_group_name, @
la_entity_toggle_flags, @
ia_minimum_id, @
ia_maximum_id, @
ia_offset )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function neutral_export2()
#
# This session file will open a existing database
# ’plate.db’ and will export it to Neutral format
# database by name plate_neutral.out.1.
#
# Before running this session file run plate.ses
# to create plate.db
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function neutral_export2()
# has the following arguments:
#
# neutral_export2
# ( file_name,
# title,
# entity_toggle_flags,
# all_groups,
# number_of_groups,
# group_entity_ids )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_title[64]
LOGICAL la_entity_toggle_flags(35)
LOGICAL l_all_groups
INTEGER i_number_of_groups
INTEGER ia_group_entity_ids(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open the database "plate.db"
uil_file_open.go("plate.db")
#---------------------------------------------------------------------
# Exporting following entity types to the file ’plate_neutral.out.1’
# Entity types - Nodes, Elements, Material, Element Properties
la_entity_toggle_flags(1) = TRUE
la_entity_toggle_flags(2) = TRUE
la_entity_toggle_flags(3) = TRUE
la_entity_toggle_flags(4) = TRUE
s_file_name = "plate_neutral.out"
s_title = "File created by exporting Patran database"
l_all_groups = FALSE
i_number_of_groups = 1
ia_group_entity_ids = [1, 0, 0, 0]
#
i_return_value = @
neutral_export2 @
( s_file_name, @
s_title, @
la_entity_toggle_flags, @
l_all_groups, @
i_number_of_groups, @
ia_group_entity_ids )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function p3_express_import()
#
# This session file will open a new database by
# name ’new.db’ and import a ’Express Neutral’
# model named ’sgm_cv_block-hole.exp’.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function p3_express_import()
# has the following arguments:
#
# p3_express_import
# ( option_file,
# file_name,
# geometry_tracking,
# reset_tolerance,
# tolerance_prompt,
# return_entity_count,
# entities )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_option_file[32]
STRING s_file_name[32]
LOGICAL l_geometry_tracking
LOGICAL l_reset_tolerance
LOGICAL l_tolerance_prompt
LOGICAL l_return_entity_count
INTEGER iaa_entities(64,2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Calling function to import model ’sgm_cv_block-hole.exp’.A log file
# by name ’ComputerVision_Geometry.log.01’ will be written. Also form
# will appear indicating the change in tolerance.
s_file_name = "sgm_cv_block-hole.exp"
l_geometry_tracking = TRUE
l_reset_tolerance = TRUE
l_tolerance_prompt = TRUE
l_return_entity_count = TRUE
#
i_return_value = @
p3_express_import @
( s_option_file, @
s_file_name, @
l_geometry_tracking, @
l_reset_tolerance, @
l_tolerance_prompt, @
l_return_entity_count, @
iaa_entities )
dump i_return_value
dump iaa_entities
#---------------------------------------------------------------------
# Exiting the import operation without deleting the express file.
i_return_value = @
p3_express_import_exit( TRUE, FALSE )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function p3_express_import_preview()
#
# This session file will open a new database by
# name ’new.db’ and find summary information of
# a ’Express Neutral’ model named
# ’sgm_cv_block-hole.exp’.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function p3_express_import_preview()
# has the following arguments:
#
# p3_express_import_preview
# ( option_file,
# file_name,
# tolerance_check,
# return_entity_count,
# entities,
# cad_attributes,
# cad_tolerance,
# shortest_curve_length )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_option_file[32]
STRING s_file_name[32]
LOGICAL l_tolerance_check
LOGICAL l_return_entity_count
INTEGER iaa_entities(64,2)
STRING sa_cad_attributes[2](256)
REAL r_cad_tolerance
REAL r_shortest_curve_length
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Calling function to get the geometry information of the model
# ’sgm_cv_block-hole.exp’ and calculate the tolerance also.
s_file_name = "sgm_cv_block-hole.exp"
l_tolerance_check = TRUE
l_return_entity_count = TRUE
#
i_return_value = @
p3_express_import_preview @
( s_option_file, @
s_file_name, @
l_tolerance_check, @
l_return_entity_count, @
iaa_entities, @
sa_cad_attributes, @
r_cad_tolerance, @
r_shortest_curve_length )
dump i_return_value
dump iaa_entities, sa_cad_attributes, r_cad_tolerance
dump r_shortest_curve_length
#---------------------------------------------------------------------
# Exiting the import operation without deleting the express file.
i_return_value = @
p3_express_import_exit( TRUE, FALSE )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function p3_express_import_exit()
#
# This session file will open a new database by
# name ’new.db’ and import a ’Express Neutral’
# model named ’sgm_cv_block-hole.exp’. And exits
# the import operation without deleting the
# express file.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function p3_express_import_exit()
# has the following arguments:
#
# p3_express_import_exit
# ( delete_option_file,
# delete_express_file )
#
#---------------------------------------------------------------------
# Variable Declarations
LOGICAL l_delete_option_file
LOGICAL l_delete_express_file
INTEGER i_return_value
STRING s_option_file[32]
STRING s_file_name[32]
LOGICAL l_geometry_tracking
LOGICAL l_reset_tolerance
LOGICAL l_tolerance_prompt
LOGICAL l_return_entity_count
INTEGER iaa_entities(64,2)
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Calling function to import model ’sgm_cv_block-hole.exp’.A log file
# by name ’ComputerVision_Geometry.log.01’ will be written. Also form
# will appear indicating the change in tolerance.
s_file_name = "sgm_cv_block-hole.exp"
l_geometry_tracking = TRUE
l_reset_tolerance = TRUE
l_tolerance_prompt = TRUE
l_return_entity_count = TRUE
#
i_return_value = @
p3_express_import @
( s_option_file, @
s_file_name, @
l_geometry_tracking, @
l_reset_tolerance, @
l_tolerance_prompt, @
l_return_entity_count, @
iaa_entities )
dump i_return_value
dump iaa_entities
#---------------------------------------------------------------------
# Exiting the import operation without deleting the files.
l_delete_option_file = FALSE
l_delete_express_file = FALSE
#
i_return_value = @
p3_express_import_exit @
( l_delete_option_file, @
l_delete_express_file )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function p3_express_options_file()
#
# This session file will write an options file
# named ’exampla.exp’ for express model named
# ’sgm_cv_block-hole.exp’. Then will open a new
# database by name ’new.db’ and import the same
# ’Express Neutral’ model.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function p3_express_options_file()
# has the following arguments:
#
# p3_express_options_file
# ( option_file,
# versioning,
# file_format,
# action,
# source,
# transform_exists,
# transformation,
# number_of_groups,
# group_names,
# group_entities,
# group_layers,
# group_colors,
# all_entities,
# entities,
# all_layers,
# layers,
# all_colors,
# colors,
# trimmed_curve_type,
# trimmed_surface_type,
# solid_representation )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_option_file[16]
LOGICAL l_versioning
INTEGER i_file_format
INTEGER i_action
INTEGER i_source
LOGICAL l_transform_exists
REAL ra_transformation(12)
INTEGER i_number_of_groups
STRING sa_group_names[16](3)
INTEGER iaa_group_entities(3,3)
INTEGER iaa_group_layers(3,1)
INTEGER iaa_group_colors(3,1)
LOGICAL l_all_entities
INTEGER ia_entities(64)
LOGICAL l_all_layers
INTEGER ia_layers(256)
LOGICAL l_all_colors
INTEGER ia_colors(10)
INTEGER i_trimmed_curve_type
INTEGER i_trimmed_surface_type
INTEGER i_solid_representation
INTEGER i_return_value
STRING s_file_name[32]
LOGICAL l_geometry_tracking
LOGICAL l_reset_tolerance
LOGICAL l_tolerance_prompt
LOGICAL l_return_entity_count
INTEGER iaa_entities(64,2)
#---------------------------------------------------------------------
# Calling function to write options file by name ’example.exp’. The
# file will be written in ascii without the transformation matrix.
s_option_file = "example.exp"
i_file_format = 1
i_action = 1
# Making the source of the geometry entities as PDA ENGINEERING.
i_source = 52054
# Three groups will be created while importing. And entities will be
# separated in these groups.
i_number_of_groups =3
sa_group_names(1) = "curve"
sa_group_names(2) = "surface"
sa_group_names(3) = "solid"
iaa_group_entities = [[1 102 0][1 1002 0][1 2002 0]]
# All layers and colors will be read in for each group.
iaa_group_layers = [[-1][-1][-1]]
iaa_group_colors = [[0][0][0]]
l_all_entities = TRUE
l_all_layers = TRUE
l_all_colors = TRUE
# Only preference for trimmed surface will be
# set to ’only general trimmed surface’
i_trimmed_curve_type = 3
i_trimmed_surface_type = 2
i_solid_representation = 3
#
i_return_value = @
p3_express_options_file @
( s_option_file, @
l_versioning, @
i_file_format, @
i_action, @
i_source, @
l_transform_exists, @
ra_transformation, @
i_number_of_groups, @
sa_group_names, @
iaa_group_entities, @
iaa_group_layers, @
iaa_group_colors, @
l_all_entities, @
ia_entities, @
l_all_layers, @
ia_layers, @
l_all_colors, @
ia_colors, @
i_trimmed_curve_type, @
i_trimmed_surface_type, @
i_solid_representation )
dump i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Calling function to import model ’sgm_cv_block-hole.exp’. Using the
# options file created. A log file by name
# ’ComputerVision_Geometry.log.01’ will be written. Also form will
# appear indicating the change in tolerance.
s_file_name = "sgm_cv_block-hole.exp"
l_geometry_tracking = TRUE
l_reset_tolerance = TRUE
l_tolerance_prompt = TRUE
l_return_entity_count = TRUE
#
i_return_value = @
p3_express_import @
( s_option_file, @
s_file_name, @
l_geometry_tracking, @
l_reset_tolerance, @
l_tolerance_prompt, @
l_return_entity_count, @
iaa_entities )
$? NOFORALL 1000034
dump i_return_value
dump iaa_entities
#---------------------------------------------------------------------
# Exiting the import operation without deleting the files.
i_return_value = @
p3_express_import_exit( FALSE, FALSE )
dump i_return_value
#---------------------------------------------------------------------
() |
FUNCTION attribute_import_body( output_name )
STRING output_name[]
INTEGER i, status, nc, nsrf, nsol, entity_id(1), min_label, label
STRING attr_name[VIRTUAL], psidentifier[256]
INTEGER endLabel, startLabel, fid
psidentifier = "SDL/TYSA_NAME"
utl_process_spawn( "rm -f " // output_name, TRUE )
status = fio_openw( output_name, fid )
status = db_count_solid( nsol )
status = db_get_min_solid_label( min_label )
status = db_get_max_solid_label( endLabel )
label = min_label
startLabel = label
fio_writec( fid, "minimum solid label = %d \n", startLabel )
fio_writec( fid, "maximum solid label = %d \n\n", endLabel )
fio_writec( fid, "Identifier: %s\n",psidentifier )
fio_writec( fid, "Function: ps_get_body_string_attribute\n\n" )
IF( label > 0 ) THEN
fio_writec( fid, "Number of solids = %d\n",nsol)
FOR (i = startLabel TO endLabel)
status = db_get_solid_id( label, entity_id(1) )
status = ps_get_body_string_attribute( entity_id(1),
4,psidentifier, 0, attr_name )
fio_writec( fid, "status from ps_get_body_string_attribute =
%d \n", status )
IF( status == 0 ) THEN
fio_writec( fid, "solid %d : Body Attribute name =
%s\n",entity_id(1), attr_name )
END IF
fio_writec( fid, "\n" )
label += 1
END FOR
END IF
status = db_count_surface( nsrf )
status = db_get_min_surface_label( min_label )
status = db_get_max_surface_label( endLabel )
label = min_label
startLabel = label
fio_writec( fid, "minimum surface label = %d \n", startLabel )
fio_writec( fid, "maximum surface label = %d \n", endLabel )
IF( label > 0 ) THEN
fio_writec( fid, "Number of surfaces = %d\n",nsrf)
FOR (i = startLabel TO endLabel)
status = db_get_surface_id( label, entity_id(1) )
status = ps_get_body_string_attribute( entity_id(1), 3,
psidentifier, 0, attr_name )
fio_writec( fid, "status from ps_get_body_string_attribute =
%d \n", status )
IF( status == 0 ) THEN
fio_writec( fid, "surface %d : Body Attribute name =
%s\n",entity_id(1), attr_name )
END IF
fio_writec( fid, "\n" )
label += 1
END FOR
END IF
status = db_count_curve( nc )
status = db_get_min_curve_label( min_label )
status = db_get_max_curve_label( endLabel )
label = min_label
startLabel = label
fio_writec( fid, "minimum curve label = %d \n", startLabel )
fio_writec( fid, "maximum curve label = %d \n", endLabel )
IF( label > 0 ) THEN
fio_writec( fid, "Number of curves = %d\n",nc)
FOR (i = startLabel TO endLabel)
status = db_get_curve_id( label, entity_id(1) )
status = ps_get_body_string_attribute( entity_id(1), 2,
psidentifier, 0, attr_name )
fio_writec( fid, "status from ps_get_body_string_attribute =
%d\n", status )
IF( status == 0 ) THEN
fio_writec( fid, "curve %d : Body Attribute name = %s\n",
entity_id(1), attr_name )
END IF
fio_writec( fid, "\n" )
label += 1
END FOR
END IF
fio_close( fid )
END FUNCTION
() |
FUNCTION attribute_import_topology( output_name )
STRING output_name[]
INTEGER i, status, nc, nsrf, nsol, entity_id(1), min_label, label
STRING attr_name[VIRTUAL], psidentifier[256]
INTEGER endLabel, startLabel, fid
psidentifier = "SDL/TYSA_NAME"
utl_process_spawn( "rm -f " // output_name, TRUE )
status = fio_openw( output_name, fid )
status = db_count_solid( nsol )
status = db_get_min_solid_label( min_label )
status = db_get_max_solid_label( endLabel )
label = min_label
startLabel = label
fio_writec( fid, "minimum solid label = %d \n", startLabel )
fio_writec( fid, "maximum solid label = %d \n\n", endLabel )
fio_writec( fid, "Identifier: %s\n",psidentifier )
fio_writec( fid, "Function: ps_get_string_attribute\n\n" )
IF( label > 0 ) THEN
fio_writec( fid, "Number of solids = %d\n",nsol)
FOR (i = startLabel TO endLabel)
status = db_get_solid_id( label, entity_id(1) )
status = ps_get_string_attribute( entity_id(1),
4,psidentifier, 0, attr_name )
fio_writec( fid, "status from ps_get_string_attribute =
%d \n", status )
IF( status == 0 ) THEN
fio_writec( fid, "solid %d : Attribute name =
%s\n",entity_id(1), attr_name )
END IF
fio_writec( fid, "\n" )
label += 1
END FOR
END IF
status = db_count_surface( nsrf )
status = db_get_min_surface_label( min_label )
status = db_get_max_surface_label( endLabel )
label = min_label
startLabel = label
fio_writec( fid, "minimum surface label = %d \n", startLabel )
fio_writec( fid, "maximum surface label = %d \n", endLabel )
IF( label > 0 ) THEN
fio_writec( fid, "Number of surfaces = %d\n",nsrf)
FOR (i = startLabel TO endLabel)
status = db_get_surface_id( label, entity_id(1) )
status = ps_get_string_attribute( entity_id(1), 3,
psidentifier, 0, attr_name )
fio_writec( fid, "status from ps_get_string_attribute =
%d \n", status )
IF( status == 0 ) THEN
fio_writec( fid, "surface %d : Attribute name =
%s\n",entity_id(1), attr_name )
END IF
fio_writec( fid, "\n" )
label += 1
END FOR
END IF
status = db_count_curve( nc )
status = db_get_min_curve_label( min_label )
status = db_get_max_curve_label( endLabel )
label = min_label
startLabel = label
fio_writec( fid, "minimum curve label = %d \n", startLabel )
fio_writec( fid, "maximum curve label = %d \n", endLabel )
IF( label > 0 ) THEN
fio_writec( fid, "Number of curves = %d\n",nc)
FOR (i = startLabel TO endLabel)
status = db_get_curve_id( label, entity_id(1) )
status = ps_get_string_attribute( entity_id(1), 2,
psidentifier, 0, attr_name )
fio_writec( fid, "status from ps_get_string_attribute =
%d\n", status )
IF( status == 0 ) THEN
fio_writec( fid, "curve %d : Attribute name = %s\n",
entity_id(1), attr_name )
END IF
fio_writec( fid, "\n" )
label += 1
END FOR
END IF
fio_close( fid )
END FUNCTION
FUNCTION publication_import( output_name )
$ This function searches for CAD tags from CATIA and creates a matched array of labels: p3 <-> CATIA
STRING output_name[]
STRING p3_labels[32](VIRTUAL), CATIA_labels[512](VIRTUAL)
INTEGER num_publications = 0
INTEGER i, status, nc, nsrf, nsol, entity_id(1)
INTEGER min_labelS, min_labelF, min_labelC, label
INTEGER endLabelS, endLabelF, endLabelC
STRING attr_name[VIRTUAL], battr_name[VIRTUAL], psidentifier[256]
INTEGER fid
STRING face_name_prefix[32], face_name[32], edge_name_prefix[32], edge_name[32]
INTEGER dummy(VIRTUAL), j, k, m
INTEGER faces(VIRTUAL),nfaces
INTEGER num_edges, number_loops, loop_ids(VIRTUAL), edge_orients(VIRTUAL), edge_ids(VIRTUAL)
REAL time(10)
INTEGER method, handle, attribute, internal_curve_id(1)
INTEGER num_faces_found = 0, num_edges_found = 0
INTEGER found_faces(VIRTUAL), found_edges(VIRTUAL)
LOGICAL face_found, edge_found
time(1) = sys_cputime()
psidentifier = "SDL/TYSA_NAME"
utl_process_spawn( "rm -f " // output_name, TRUE )
status = fio_openw( output_name, fid )
status = db_count_solid( nsol )
status = db_get_min_solid_label( min_labelS )
status = db_get_max_solid_label( endLabelS )
status = db_count_surface( nsrf )
status = db_get_min_surface_label( min_labelF )
status = db_get_max_surface_label( endLabelF )
status = db_count_curve( nc )
status = db_get_min_curve_label( min_labelC )
status = db_get_max_curve_label( endLabelC )
$ Allocate space for array of face and edge ids to prevent duplication
sys_allocate_array( found_faces, 1, nsrf )
sys_allocate_array( found_edges, 1, nc )
$ Allocate space for array of labels to return
sys_allocate_array( p3_labels, 1, nsol+nsrf+nc )
sys_allocate_array( CATIA_labels, 1, nsol+nsrf+nc )
fio_writec( fid, "Solids: Number=%d minimum=%d maximum=%d \n",nsol, min_labelS, endLabelS )
fio_writec( fid, "Surfaces: Number=%d minimum=%d maximum=%d \n",nsrf, min_labelF, endLabelF)
fio_writec( fid, "Curves: Number=%d minimum=%d maximum=%d \n\n",nc, min_labelC, endLabelC )
fio_writec( fid, "Identifier: %s\n",psidentifier )
fio_writec( fid, "Function: ps_get_string_attribute\n\n" )
if(min_labelF==0) THEN min_labelF = 1
if(endLabelF==0) THEN endLabelF = nsrf
if(min_labelC==0) THEN min_labelC = 1
if(endLabelC==0) THEN endLabelC = nc
IF( nsol > 0 ) THEN
FOR (i = min_labelS TO endLabelS)
status = db_get_solid_id( i, entity_id(1) )
status = ps_get_string_attribute( entity_id(1), 4, psidentifier, 0, attr_name )
IF( status == 0 ) THEN
status = db_get_solid_label( entity_id(1), label )
fio_writec( fid, "solid %d [Solid %d] : Attribute name = %s\n",label, entity_id(1), attr_name )
num_publications += 1
p3_labels(num_publications) = "Solid " // str_from_integer( label )
CATIA_labels(num_publications) = attr_name
END IF
$ do all faces on this solid:
face_name_prefix = "Solid " // str_from_integer( i ) //"."
sgm_db_get_num_faces_body( entity_id(1),nfaces,status)
IF( status != 0) THEN
msg_to_form( status, 4, appcode(status),1,1.,"")
RETURN status
END IF
$ Allocate memory:
status = sys_allocate_array( faces, 1, nfaces )
IF( status != 0) THEN
msg_to_form( status, 4, appcode(status),1,1.,"")
RETURN status
END IF
status = sys_allocate_array( dummy, 1, nfaces )
IF( status != 0) THEN
msg_to_form( status, 4, appcode(status),1,1.,"")
RETURN status
END IF
$ Get the list of faces referenced by the body
sgm_db_get_gen_body_face_ids( entity_id(1), nfaces, faces, dummy, @
dummy, status )
IF( status != 0) THEN
msg_to_form( status, 4, appcode(status),1,1.,"")
RETURN status
END IF
FOR( j = 1 TO nfaces )
face_name = face_name_prefix // str_from_integer( j )
$ fio_writec( fid, "Face name = %s Surface id = %d\n",face_name, faces(i) )
face_found = FALSE
FOR( m = 1 TO num_faces_found )
IF(found_faces(m)==faces(j)) THEN face_found = TRUE
END FOR
IF(face_found!=TRUE) THEN
status = ps_get_string_attribute( faces(j), 3, psidentifier, 0, attr_name )
IF( status == 0 ) THEN
fio_writec( fid, "%s [Face %d] : Attribute name = %s\n", @
face_name, faces(j), attr_name )
num_publications += 1
p3_labels(num_publications) = face_name
CATIA_labels(num_publications) = attr_name
num_faces_found += 1
found_faces(num_faces_found) = faces(j)
END IF
END IF
status = sgm_db_get_num_edges_face( faces(j), num_edges )
IF( status != 0 ) THEN BREAK
sgm_db_get_num_vertices_surface( faces(j), num_edges, status )
edge_name_prefix = face_name // "."
$ Allocate and initialize virtual strings
sys_allocate_array( edge_ids, 1, num_edges )
sys_allocate_array( loop_ids, 1, num_edges )
sys_allocate_array( edge_orients, 1, num_edges )
status = sgm_db_get_gen_face_edge_ids ( faces(i), number_loops, num_edges, @
loop_ids, edge_ids, edge_orients )
FOR( k = 1 TO num_edges )
edge_name = edge_name_prefix // str_from_integer( k )
$ method = LP_EVAL_FOR_ID = 4, LP_ATTRIBUTE_ID = 1
method = 4 ; attribute = 1
status = lp_eval( edge_name, method, handle )
IF(status==0) THEN
status = lp_sublist_attribute_get_int( handle, attribute, internal_curve_id )
END IF
lp_eval_cleanup(handle)
edge_found = FALSE
FOR( m = 1 TO num_edges_found )
IF(found_edges(m)==internal_curve_id(1)) THEN edge_found = TRUE
END FOR
IF(edge_found!=TRUE) THEN
status = ps_get_string_attribute( internal_curve_id(1), 2, psidentifier, 0, attr_name )
IF( status == 0 ) THEN
fio_writec( fid, "%s [Edge %d] : Attribute name = %s\n", @
edge_name, internal_curve_id(1), attr_name )
num_publications += 1
p3_labels(num_publications) = edge_name
CATIA_labels(num_publications) = attr_name
num_edges_found += 1
found_edges(num_edges_found) = internal_curve_id(1)
END IF
END IF
END FOR
END FOR
label += 1
END FOR
END IF
fio_writec( fid, "\n" )
battr_name = ""
$ Get directly creates surfaces and curves
IF( nsrf > 0 ) THEN
FOR (i = min_labelF TO endLabelF)
/*status = db_get_surface_id( label, entity_id(1) )*/
entity_id(1) = i
face_found = FALSE
FOR( m = 1 TO num_faces_found )
IF(found_faces(m)==entity_id(1)) THEN face_found = TRUE
END FOR
IF(face_found!=TRUE) THEN
status = ps_get_string_attribute( entity_id(1), 3, psidentifier, 0, attr_name )
IF( status == 0 ) THEN
status = db_get_surface_label( entity_id(1), label )
$ a label of -1 means it is not an actual surface
IF(label!=-1) THEN
fio_writec( fid, "Surface %d [Face %d] : Attribute name = %s\n",@
label, entity_id(1), attr_name )
num_publications += 1
p3_labels(num_publications) = "Surface " // str_from_integer( label )
CATIA_labels(num_publications) = attr_name
num_faces_found += 1
found_faces(num_faces_found) = entity_id(1)
END IF
END IF
END IF
label += 1
END FOR
END IF
fio_writec( fid, "\n" )
battr_name = ""
IF( nc > 0 ) THEN
FOR (i = 1 TO endLabelC)
entity_id(1) = i
edge_found = FALSE
FOR( m = 1 TO num_edges_found )
IF(found_edges(m)==entity_id(1)) THEN edge_found = TRUE
END FOR
IF(edge_found!=TRUE) THEN
status = ps_get_string_attribute( entity_id(1), 2, psidentifier, 0, attr_name )
IF( status == 0 ) THEN
status = db_get_curve_label( entity_id(1), label )
$ a label of -1 means it is not an actual curve
IF(label!=-1) THEN
fio_writec( fid, "Curve %d [Edge %d] : Attribute name = %s\n", @
label, entity_id(1), attr_name )
num_publications += 1
p3_labels(num_publications) = "Curve " // str_from_integer( label )
CATIA_labels(num_publications) = attr_name
num_edges_found += 1
found_edges(num_edges_found) = entity_id(1)
END IF
END IF
END IF
label += 1
END FOR
END IF
fio_writec( fid, "\n" )
time(2) = sys_cputime()
fio_writec( fid, "Total computation time = %f seconds\n", time(2)-time(1) )
fio_close( fid )
IF( num_publications > 0 ) THEN
sys_reallocate_array( p3_labels, 1, num_publications )
sys_reallocate_array( CATIA_labels, 1, num_publications )
END IF
dump p3_labels, CATIA_labels
RETURN num_publications
END FUNCTION
() |
#
# Purpose : This file provides an example of a call to the
# function select_focus.exit()
#
# This session file will open a new database by
# name ’new.db’. A curve and a surface will be
# drawn so that the curve is overlapping with one
# edge from the surface.
# After this the session file will be paused and
# the user will have to try to delete the curve
# by screen picking. Which will make the
# ’Selection’ window appear on the screen. The
# session file will be resumed after that. In
# effect this function will be executed and the
# selection window will disappear.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function select_focus.exit() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
STRING sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating a curve.
i_return_value = @
asm_const_line_xyz( "1", "<1 0 0>", "[0 0 0]", "Coord 0", @
sv_asm_create_line_xyz_crtd_ids )
dump i_return_value
# Drawing a surface so that an edge of the surface will overlap with
# the curve.
i_return_value = @
asm_const_patch_xyz( "1", "<1 1 0>", "[0 0 0]", "Coord 0", @
sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Session file paused. Press "Resume" to continue..
# User should open the ’Geometry’ form and try to ’Delete’ the curve
# by clicking on the screen. While trying this the ’Object’ should be
# ’Any’. After the selection window appears on the screen the
# ’Resume’ button should be pressed.
sf_pause()
#---------------------------------------------------------------------
# Calling function to remove the selection window.
#
select_focus.exit()
sys_free_string(sv_asm_create_patch_xy_crtd_ids)
sys_free_string(sv_asm_create_line_xyz_crtd_ids)
#---------------------------------------------------------------------e
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_cad_access_v1()
#
# This session file will open a new database by
# name ’new.db’. UG file named ’asm002.prt’ is
# imported with all its entities in default_group
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_cad_access_v1()
# has the following arguments:
#
# sgm_cad_access_v1
# ( file_name,
# file_name_length,
# group_name,
# group_name_length,
# entity_toggle_values,
# simply_trimmed,
# access_as_solids,
# enable_tol_prompt,
# color_toggle_values,
# all_layers,
# active_layer,
# layer_numbers,
# mod_type,
# number_of_groups,
# group_entity_ids,
# group_entity_values,
# group_color_values,
# active_layer_values,
# layer_pointers,
# group_layers,
# I_N_UG_LAYERS,
# ug_count,
# patran_count )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
INTEGER i_file_name_length
STRING s_group_name[80]
INTEGER i_group_name_length
LOGICAL la_entity_toggle_values(35)
LOGICAL l_simply_trimmed
LOGICAL l_access_as_solids
LOGICAL l_enable_tol_prompt
LOGICAL la_color_toggle_values(14)
LOGICAL l_all_layers
LOGICAL l_active_layer
INTEGER ia_layer_numbers(256)
STRING s_mod_type[6]
INTEGER i_number_of_groups
INTEGER ia_group_entity_ids(1)
LOGICAL laa_group_entity_values(1,20)
LOGICAL laa_group_color_values(1,14)
LOGICAL la_active_layer_values(256)
INTEGER ia_layer_pointers(1)
INTEGER ia_group_layers(512)
integer i_n_ug_layers
INTEGER iaa_ug_count(256,37)
INTEGER ia_patran_count(4)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Calling function to import all entities from UG model ’asm002.prt’.
# Tolerance prompt will be displayed on the screen.
s_file_name = "asm002.prt"
i_file_name_length =10
s_group_name = "default_group"
i_group_name_length = 13
l_simply_trimmed = true
l_enable_tol_prompt = true
l_all_layers = true
s_mod_type ="ug"
i_number_of_groups =1
ia_group_entity_ids =[1]
ia_layer_pointers = [1]
ia_group_layers(1) = 1
la_entity_toggle_values=[true true true true true true true true true@
true true true true true true true true true true false false @
false false false false false false false false false false false @
false false false]
laa_group_entity_values=[true true true true true true true true true@
true true true true true true true true true true false]
#
i_return_value = @
sgm_cad_access_v1 @
( s_file_name, @
i_file_name_length, @
s_group_name, @
i_group_name_length, @
la_entity_toggle_values, @
l_simply_trimmed, @
l_access_as_solids, @
l_enable_tol_prompt, @
la_color_toggle_values, @
l_all_layers, @
l_active_layer, @
ia_layer_numbers, @
s_mod_type, @
i_number_of_groups, @
ia_group_entity_ids, @
laa_group_entity_values, @
laa_group_color_values, @
la_active_layer_values, @
ia_layer_pointers, @
ia_group_layers, @
i_n_ug_layers, @
iaa_ug_count, @
ia_patran_count )
dump i_return_value
dump ia_patran_count,i_n_ug_layers
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_catia_access()
#
# This session file will open a new database by
# name ’new.db’. A Catia model named
# ’catia_cam.cat’ will be imported in the default
# group with all entities. Model will be made
# visible on the screen.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_catia_access()
# has the following arguments:
#
# sgm_catia_access
# ( file_name,
# group_name,
# group_name_length,
# entity_toggle_values,
# simply_trimmed,
# color_toggle_values,
# all_layers,
# active_layer,
# layer_numbers,
# mod_type,
# number_of_groups,
# group_entity_ids,
# group_entity_values,
# group_color_values,
# active_layer_values,
# layer_pointers,
# group_layers,
# interactive_flag,
# user_control_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_group_name[32]
INTEGER i_group_name_length
LOGICAL la_entity_toggle_values(35)
LOGICAL l_simply_trimmed
LOGICAL la_color_toggle_values(14)
LOGICAL l_all_layers
LOGICAL l_active_layer
INTEGER ia_layer_numbers(256)
STRING s_mod_type[6]
INTEGER i_number_of_groups = 1
INTEGER ia_group_entity_ids(2)
LOGICAL laa_group_entity_values(2,20)
LOGICAL laa_group_color_values(2,14)
LOGICAL la_active_layer_values(256)
INTEGER ia_layer_pointers(2)
INTEGER ia_group_layers(8)
INTEGER i_interactive_flag
INTEGER ia_user_control_flag(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Importing all entities of file named "catia_cam.cat".
s_file_name = "catia_cam.cat"
s_group_name = "default_group"
i_group_name_length = 13
l_all_layers = TRUE
s_mod_type = "catia"
ia_group_entity_ids = [1,0]
la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE]
#
i_return_value = @
sgm_catia_access @
( s_file_name, @
s_group_name, @
i_group_name_length, @
la_entity_toggle_values, @
l_simply_trimmed, @
la_color_toggle_values, @
l_all_layers, @
l_active_layer, @
ia_layer_numbers, @
s_mod_type, @
i_number_of_groups, @
ia_group_entity_ids, @
laa_group_entity_values, @
laa_group_color_values, @
la_active_layer_values, @
ia_layer_pointers, @
ia_group_layers, @
i_interactive_flag, @
ia_user_control_flag )
dump i_return_value
#---------------------------------------------------------------------
# Model is made visible in the viewport.
i_return_value = ga_view_corners_set([125.,-60.,0],[150.,-20.,0],1)
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_catia_access_v1()
#
# This session file will open a new database by
# name ’new.db’. A Catia model named
# ’catia_cam.cat’ will be imported in the default
# group with all entities. Model will be made
# visible on the screen.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_catia_access_v1()
# has the following arguments:
#
# sgm_catia_access_v1
# ( file_name,
# group_name,
# group_name_length,
# entity_toggle_values,
# simply_trimmed,
# enable_tol_prompt,
# color_toggle_values,
# all_layers,
# active_layer,
# layer_numbers,
# mod_type,
# number_of_groups,
# group_entity_ids,
# group_entity_values,
# group_color_values,
# active_layer_values,
# layer_pointers,
# group_layers,
# interactive_flag,
# user_control_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_group_name[32]
INTEGER i_group_name_length
LOGICAL la_entity_toggle_values(35)
LOGICAL l_simply_trimmed
LOGICAL l_enable_tol_prompt
LOGICAL la_color_toggle_values(14)
LOGICAL l_all_layers
LOGICAL l_active_layer
INTEGER ia_layer_numbers(256)
STRING s_mod_type[6]
INTEGER i_number_of_groups = 1
INTEGER ia_group_entity_ids(2)
LOGICAL laa_group_entity_values(2,20)
LOGICAL laa_group_color_values(2,14)
LOGICAL la_active_layer_values(256)
INTEGER ia_layer_pointers(2)
INTEGER ia_group_layers(8)
INTEGER i_interactive_flag
INTEGER ia_user_control_flag(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Importing all entities of file named "catia_cam.cat". Form
# indicating proposed change in tolerance will appear on the screen.
s_file_name = "catia_cam.cat"
s_group_name = "default_group"
i_group_name_length = 13
l_enable_tol_prompt = TRUE
l_all_layers = TRUE
s_mod_type = "catia"
ia_group_entity_ids = [1,0]
la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE]
#
i_return_value = @
sgm_catia_access_v1 @
( s_file_name, @
s_group_name, @
i_group_name_length, @
la_entity_toggle_values, @
l_simply_trimmed, @
l_enable_tol_prompt, @
la_color_toggle_values, @
l_all_layers, @
l_active_layer, @
ia_layer_numbers, @
s_mod_type, @
i_number_of_groups, @
ia_group_entity_ids, @
laa_group_entity_values, @
laa_group_color_values, @
la_active_layer_values, @
ia_layer_pointers, @
ia_group_layers, @
i_interactive_flag, @
ia_user_control_flag )
dump i_return_value
#---------------------------------------------------------------------
# Model is made visible in the viewport.
i_return_value =ga_view_corners_set([125.,-60.,0],[150.,-20.,0],1)
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_euclid_access()
#
# This session file will open a new database by
# name ’new.db’. A Euclid model named
# ’euclid_exo_2.pat’ will be imported in the
# default group with all entities. Model will be
# made visible on the screen.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_euclid_access()
# has the following arguments:
#
# sgm_euclid_access
# ( file_name,
# group_name,
# group_name_length,
# entity_toggle_values,
# simply_trimmed,
# color_toggle_values,
# all_layers,
# active_layer,
# layer_numbers,
# mod_type,
# number_of_groups,
# group_entity_ids,
# group_entity_values,
# group_color_values,
# active_layer_values,
# layer_pointers,
# group_layers,
# interactive_flag,
# user_control_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_group_name[32]
INTEGER i_group_name_length
LOGICAL la_entity_toggle_values(35)
LOGICAL l_simply_trimmed
LOGICAL la_color_toggle_values(14)
LOGICAL l_all_layers
LOGICAL l_active_layer
INTEGER ia_layer_numbers(256)
STRING s_mod_type[6]
INTEGER i_number_of_groups = 1
INTEGER ia_group_entity_ids(2)
LOGICAL laa_group_entity_values(2,20)
LOGICAL laa_group_color_values(2,14)
LOGICAL la_active_layer_values(256)
INTEGER ia_layer_pointers(2)
INTEGER ia_group_layers(8)
INTEGER i_interactive_flag
INTEGER ia_user_control_flag(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Importing all entities of file named "euclid_exo_2.pat".
s_file_name = "euclid_exo_2.pat"
s_group_name = "default_group"
i_group_name_length = 13
l_all_layers = TRUE
s_mod_type = "euclid"
ia_group_entity_ids = [1,0]
la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE]
#
i_return_value = @
sgm_euclid_access @
( s_file_name, @
s_group_name, @
i_group_name_length, @
la_entity_toggle_values, @
l_simply_trimmed, @
la_color_toggle_values, @
l_all_layers, @
l_active_layer, @
ia_layer_numbers, @
s_mod_type, @
i_number_of_groups, @
ia_group_entity_ids, @
laa_group_entity_values, @
laa_group_color_values, @
la_active_layer_values, @
ia_layer_pointers, @
ia_group_layers, @
i_interactive_flag, @
ia_user_control_flag )
dump i_return_value
#---------------------------------------------------------------------
# Model is made visible in the viewport.
i_return_value =ga_view_corners_set([-70.,-70.,0],[70.,70.,0],1)
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_euclid_access_v1()
#
# This session file will open a new database by
# name ’new.db’. A Euclid model named
# ’euclid_exo_2.pat’ will be imported in the
# default group with all entities. Model will be
# made visible on the screen.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_euclid_access_v1()
# has the following arguments:
#
# sgm_euclid_access_v1
# ( file_name,
# group_name,
# group_name_length,
# entity_toggle_values,
# simply_trimmed,
# enable_tol_prompt,
# color_toggle_values,
# all_layers,
# active_layer,
# layer_numbers,
# mod_type,
# number_of_groups,
# group_entity_ids,
# group_entity_values,
# group_color_values,
# active_layer_values,
# layer_pointers,
# group_layers,
# interactive_flag,
# user_control_flag )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_group_name[32]
INTEGER i_group_name_length
LOGICAL la_entity_toggle_values(35)
LOGICAL l_simply_trimmed
LOGICAL l_enable_tol_prompt
LOGICAL la_color_toggle_values(14)
LOGICAL l_all_layers
LOGICAL l_active_layer
INTEGER ia_layer_numbers(256)
STRING s_mod_type[6]
INTEGER i_number_of_groups = 1
INTEGER ia_group_entity_ids(2)
LOGICAL laa_group_entity_values(2,20)
LOGICAL laa_group_color_values(2,14)
LOGICAL la_active_layer_values(256)
INTEGER ia_layer_pointers(2)
INTEGER ia_group_layers(8)
INTEGER i_interactive_flag
INTEGER ia_user_control_flag(2)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Importing all entities of file named "euclid_exo_2.pat". Form
# indicating proposed change in tolerance will appear on the screen.
s_file_name = "euclid_exo_2.pat"
s_group_name = "default_group"
i_group_name_length = 13
l_enable_tol_prompt = TRUE
l_all_layers = TRUE
s_mod_type = "euclid"
ia_group_entity_ids = [1,0]
la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE]
#
i_return_value = @
sgm_euclid_access_v1 @
( s_file_name, @
s_group_name, @
i_group_name_length, @
la_entity_toggle_values, @
l_simply_trimmed, @
l_enable_tol_prompt, @
la_color_toggle_values, @
l_all_layers, @
l_active_layer, @
ia_layer_numbers, @
s_mod_type, @
i_number_of_groups, @
ia_group_entity_ids, @
laa_group_entity_values, @
laa_group_color_values, @
la_active_layer_values, @
ia_layer_pointers, @
ia_group_layers, @
i_interactive_flag, @
ia_user_control_flag )
dump i_return_value
#---------------------------------------------------------------------
# Model is made visible in the viewport.
i_return_value =ga_view_corners_set([-70.,-70.,0],[70.,70.,0],1)
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_intersect_curves()
#
# This session file will create a new database by
# name new.db and will draw two curves. These
# curves will be used for finding out minimum
# distance between the two.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_intersect_curves()
# has the following arguments:
#
# sgm_intersect_curves
# ( curve1,
# curve2,
# distance,
# u1,
# u2,
# xyz1,
# xyz2 )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL rv_curve1(VIRTUAL)
REAL rv_curve2(VIRTUAL)
REAL r_distance
REAL r_u1
REAL r_u2
REAL ra_xyz1(3)
REAL ra_xyz2(3)
INTEGER i_return_value
INTEGER i_blob_size
STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating two parallel lines.
i_return_value = @
asm_const_line_xyz( "1", "<1 0 0>", "[0 0 0]","Coord 0",@
sv_asm_create_line_xyz_crtd_ids )
dump i_return_value
i_return_value = @
asm_const_line_xyz( "2", "<1 0 0>", "[0 1 1]","Coord 0",@
sv_asm_create_line_xyz_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Getting the blob size for curves(entity type = 2) and allocating
# the memory for getting the information for curves.
# For curve ID. 1
sgm_db_get_blob_size(2,1,i_blob_size,i_return_value)
dump i_return_value
sys_allocate_array(rv_curve1,1,i_blob_size)
sgm_db_get_curve(1,i_blob_size,rv_curve1,i_return_value)
dump i_return_value
# For curve ID. 2
sgm_db_get_blob_size(2,2,i_blob_size,i_return_value)
dump i_return_value
sys_allocate_array(rv_curve2,1,i_blob_size)
sgm_db_get_curve(2,i_blob_size,rv_curve2,i_return_value)
dump i_return_value
#---------------------------------------------------------------------
# Calling the function two get the minimum distance.
#
i_return_value = @
sgm_intersect_curves @
( rv_curve1, @
rv_curve2, @
r_distance, @
r_u1, @
r_u2, @
ra_xyz1, @
ra_xyz2 )
dump i_return_value
dump r_distance,r_u1,r_u2,ra_xyz1,ra_xyz2
sys_free_array(rv_curve1)
sys_free_array(rv_curve2)
sys_free_string(sv_asm_create_line_xyz_crtd_ids)
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_nearest_point_on_surface()
#
# This session file will create a new database by
# name new.db and will draw a X-Y surface. This
# surface will be used for finding out minimum
# distance of a point(1,1,1) from the surface.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_nearest_point_on_surface()
# has the following arguments:
#
# sgm_nearest_point_on_surface
# ( point,
# surface,
# u,
# v,
# xyz )
#
#---------------------------------------------------------------------
# Variable Declarations
REAL ra_point(3)
REAL rv_surface(VIRTUAL)
REAL r_u
REAL r_v
REAL raa_xyz(3,4)
INTEGER i_return_value
INTEGER i_blob_size
STRING sv_asm_create_patch_xy_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating a patch.
i_return_value = @
asm_const_patch_xyz( "1","<1 1 0>","[0 0 0]","Coord 0", @
sv_asm_create_patch_xy_crtd_ids )
dump i_return_value
# Getting the blob size for surface(entity type = 3) and allocating
# the memory for getting the information for surface(Surface ID = 1).
sgm_db_get_blob_size(3,1,i_blob_size,i_return_value)
dump i_return_value
sys_allocate_array(rv_surface,1,i_blob_size)
sgm_db_get_surface(1,i_blob_size,rv_surface,i_return_value)
dump i_return_value
#---------------------------------------------------------------------
# Calling the function to find out shortest distance between the
# Surface and point at (1,1,1).
ra_point = [1.,1.,1.]
#
i_return_value = @
sgm_nearest_point_on_surface @
( ra_point, @
rv_surface, @
r_u, @
r_v, @
raa_xyz )
dump i_return_value
dump r_u,r_v,raa_xyz
sys_free_array(rv_surface)
sys_free_string(sv_asm_create_patch_xy_crtd_ids)
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function sgm_ptc_access_v2()
#
# This session file will open a new database by
# name ’new.db’. A Pro/ENGINEER geometry file
# named ’gn-0348.geo’ will be imported with all
# entities. Model will be made visible on the
# screen.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function sgm_ptc_access_v2()
# has the following arguments:
#
# sgm_ptc_access_v2
# ( file_name,
# file_type,
# simply_trimmed,
# create_groups,
# save_geo_file,
# enable_tol_prompt,
# pro_entities,
# pro_count,
# patran_count )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_file_type[3]
LOGICAL l_simply_trimmed
LOGICAL l_create_groups
LOGICAL l_save_geo_file
LOGICAL l_enable_tol_prompt
INTEGER ia_pro_entities(17)
INTEGER ia_pro_count(9)
INTEGER ia_patran_count(7)
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Importing all entities of file named "euclid_exo_2.pat". Form
# indicating proposed change in tolerance will appear on the screen.
s_file_name = "gn-0348.geo"
s_file_type = "GEO"
l_simply_trimmed = TRUE
l_create_groups = TRUE
l_enable_tol_prompt = TRUE
ia_pro_entities = [16, 1, 2, 3, 4, 108, 114, @
118, 120, 122, 128, 154, 156, 160, 170, 172, 174]
#
i_return_value = @
sgm_ptc_access_v2 @
( s_file_name, @
s_file_type, @
l_simply_trimmed, @
l_create_groups, @
l_save_geo_file, @
l_enable_tol_prompt, @
ia_pro_entities, @
ia_pro_count, @
ia_patran_count )
dump i_return_value, ia_pro_count, ia_patran_count
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_db_commit()
#
# This session file will open a new database by
# name ’new.db’. Initially a line will be drawn
# and ’uil_db_commit’ function will be called.
# After this one more line will be created and
# ’uil_db_undo’ function will be called twice to
# undo both the lines.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_db_commit()
# has the following arguments:
#
# uil_db_commit
# ( command )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sa_command[32]
INTEGER i_return_value
STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating line with id ’Line 1’
i_return_value = @
asm_const_line_xyz( "1", "<1 1 0>", "[0 0 0]", @
"Coord 0", sv_asm_create_line_xyz_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# The line creation will be committed.
sa_command = "committed"
#
uil_db_commit @
( sa_command )
#---------------------------------------------------------------------
# Creating line with id ’Line 2’
i_return_value = @
asm_const_line_xyz( "2", "<2 1 0>", "[0 0 0]", @
"Coord 0", sv_asm_create_line_xyz_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Attempt will be made to undo the line ’Line 2’.
uil_db_undo()
# Attempt will be made to undo the line ’Line 1’.
uil_db_undo()
#---------------------------------------------------------------------
sys_free_string(sv_asm_create_line_xyz_crtd_ids)
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of two calls to
# the function uil_db_undo()
#
# This session file will open a new database by
# name ’new.db’. Initially a line will be drawn
# and ’uil_db_commit’ function will be called.
# After this one more line will be created and
# ’uil_db_undo’ function will be called twice to
# undo both the lines.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_db_undo() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
STRING sa_command[32]
INTEGER i_return_value
STRING sv_asm_create_line_xyz_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating line with id ’Line 1’
i_return_value = @
asm_const_line_xyz( "1", "<1 1 0>", "[0 0 0]", @
"Coord 0", sv_asm_create_line_xyz_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# The line creation will be committed.
sa_command = "committed"
#
uil_db_commit @
( sa_command )
#---------------------------------------------------------------------
# Creating line with id ’Line 2’
i_return_value = @
asm_const_line_xyz( "2", "<2 1 0>", "[0 0 0]", @
"Coord 0", sv_asm_create_line_xyz_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Attempt will be made to undo the line ’Line 2’.
uil_db_undo()
# Attempt will be made to undo the line ’Line 1’.
uil_db_undo()
#---------------------------------------------------------------------
sys_free_string(sv_asm_create_line_xyz_crtd_ids)
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_file_close.go()
#
# This session file will create a new database by
# using ’template.db’ in P3_HOME directory by
# the name new.db. Session file execution will be
# paused. After pressing ’Resume’ button the
# database will be closed and the same will be
# reopened.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_file_close.go() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_template_name[32]
STRING s_file_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Create a database using ’template.db’ in P3_HOME directory.
s_template_name = ""
s_file_name = "new.db"
#
i_return_value = @
uil_file_new.go @
( s_template_name, @
s_file_name )
$? YES 36000002
dump i_return_value
#---------------------------------------------------------------------
# Session file paused. Press "Resume" to continue..
sf_pause()
#---------------------------------------------------------------------
# Database will be closed.
#
uil_file_close.go()
#---------------------------------------------------------------------
# The same database will be reopened.
#
i_return_value = @
uil_file_open.go @
( s_file_name )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_file_new.go()
#
# This session file will create a new database by
# using ’template.db’ in P3_HOME directory by
# the name new.db.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_file_new.go()
# has the following arguments:
#
# uil_file_new.go
# ( template_name,
# file_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_template_name[32]
STRING s_file_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Create a database using ’template.db’ in P3_HOME directory.
s_template_name = ""
s_file_name = "new.db"
#
i_return_value = @
uil_file_new.go @
( s_template_name, @
s_file_name )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_file_open.go()
#
# This session file will create a new database by
# using ’template.db’ in P3_HOME directory by
# the name new.db, closes the same and reopens.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_file_open.go()
# has the following arguments:
#
# uil_file_open.go
# ( file_name )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_template_name[32]
STRING s_file_name[32]
INTEGER i_return_value
#---------------------------------------------------------------------
# Create a database using ’template.db’ in P3_HOME directory.
s_template_name = ""
s_file_name = "new.db"
#
i_return_value = @
uil_file_new.go @
( s_template_name, @
s_file_name )
$? YES 36000002
dump i_return_value
#---------------------------------------------------------------------
# Database will be closed.
#
uil_file_close.go()
#---------------------------------------------------------------------
# Session file paused. Press "Resume" to continue..
sf_pause()
#---------------------------------------------------------------------
# The same database will be reopened.
#
i_return_value = @
uil_file_open.go @
( s_file_name )
dump i_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_imaging_coordframes.post_cf()
#
# This session file will open a existing database
# of name ’view.db’ tile the three viewports. A
# cylindrical coordinate frame will be created.
# The ’unpost’ function will demonstrate the
# unposting of the created coordinate frame and
# the ’post’ function will post the coordinate
# frame after a pause.
#
# Before running this session file run view.ses
# to create view.db
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_imaging_coordframes.post_cf()
# has the following arguments:
#
# uil_imaging_coordframes.post_cf
# ( contents )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_contents[16]
INTEGER i_return_value
STRING sv_asm_create_cord_3po_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open the database "view.db"
uil_file_open.go("view.db")
#---------------------------------------------------------------------
# Tiling all the viewports.
i_return_value = ga_viewport_post("default_viewport")
dump i_return_value
i_return_value = ga_viewport_post("view1")
dump i_return_value
i_return_value = ga_viewport_post("view2")
dump i_return_value
uil_viewport_tiling.tile( )
#---------------------------------------------------------------------
# Creating a coordinate frame. The frame will be posted by the create
# function.
i_return_value = @
asm_const_coord_3point( "1", "Coord 0", 2, "[0 0 0]", "[0 0 1]", @
"[1 0 0]", sv_asm_create_cord_3po_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Unposting the coordinate frame "Coord 1".
s_contents = "Coord 1"
#
i_return_value = @
uil_imaging_coordframes.unpost_cf @
( s_contents )
dump i_return_value
#---------------------------------------------------------------------
# Session file paused. Press "Resume" to continue..
sf_pause()
#---------------------------------------------------------------------
# The coordinate frame "Coord 1" will be posted.
#
i_return_value = @
uil_imaging_coordframes.post_cf @
( s_contents )
dump i_return_value
sys_free_string(sv_asm_create_cord_3po_crtd_ids)
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_imaging_coordframes.unpost_cf()
#
# This session file will open a existing database
# of name ’view.db’ tile the three viewports. A
# cylindrical coordinate frame will be created.
# The function will demonstrate the unposting of
# the created coordinate frame.
#
# Before running this session file run view.ses
# to create view.db
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_imaging_coordframes.unpost_cf()
# has the following arguments:
#
# uil_imaging_coordframes.unpost_cf
# ( contents )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_contents[16]
INTEGER i_return_value
STRING sv_asm_create_cord_3po_crtd_ids[VIRTUAL]
#---------------------------------------------------------------------
# Open the database "view.db"
uil_file_open.go("view.db")
#---------------------------------------------------------------------
# Tiling all the viewports.
i_return_value = ga_viewport_post("default_viewport")
dump i_return_value
i_return_value = ga_viewport_post("view1")
dump i_return_value
i_return_value = ga_viewport_post("view2")
dump i_return_value
uil_viewport_tiling.tile( )
#---------------------------------------------------------------------
# Creating a coordinate frame. The frame will be posted by the create
# function.
i_return_value = @
asm_const_coord_3point( "1", "Coord 0", 2, "[0 0 0]", "[0 0 1]", @
"[1 0 0]", sv_asm_create_cord_3po_crtd_ids )
dump i_return_value
#---------------------------------------------------------------------
# Session file paused. Press "Resume" to continue..
sf_pause()
#---------------------------------------------------------------------
# Unposting the coordinate frame "Coord 1".
s_contents = "Coord 1"
#
i_return_value = @
uil_imaging_coordframes.unpost_cf @
( s_contents )
dump i_return_value
sys_free_string(sv_asm_create_cord_3po_crtd_ids)
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_primary.get_menubar_id()
#
# This function gets the widget id of the
# primary menubar
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_primary.get_menubar_id() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
WIDGET w_return_value
#---------------------------------------------------------------------
# Calling function to get the primary menubar ID.
#
w_return_value = uil_primary.get_menubar_id()
dump w_return_value
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function uil_viewport_tiling.tile()
#
# This session file will create a new database by
# name ’new.db’ and three viewports at different
# locations and of different size will be created
# and tiled after a pause.
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function uil_viewport_tiling.tile() has no arguments.
#
#---------------------------------------------------------------------
# Variable Declarations
INTEGER i_return_value
#---------------------------------------------------------------------
# Open a new database "new.db"
uil_file_new.go("","new.db")
$? YES 36000002
#---------------------------------------------------------------------
# Creating three viewports at different locations on the screen.
i_return_value = ga_viewport_create("view1",0,0,4,4)
dump i_return_value
i_return_value = ga_viewport_create("view2",0,10,8,4)
dump i_return_value
i_return_value = ga_viewport_create("view3",10,0,4,7)
dump i_return_value
#---------------------------------------------------------------------
# Session file paused. Press "Resume" to continue..
sf_pause()
#---------------------------------------------------------------------
# Tiling the three views including the "default_viewport".
#
uil_viewport_tiling.tile()
#---------------------------------------------------------------------
() |
#
# Purpose : This file provides an example of a call to the
# function ugi_import_iges()
#
# This session file will open a existing database
# of name ’plate.db’. The model will be exported
# to IGES format file ’plate_IGES.igs.01’. The
# same model will be imported in a new database
# named ’new.db’ .
#
# Before running this session file run plate.ses
# to create plate.db
#
# This file can be run by starting a session of
# Patran, and running this session file
# through the "File","Session","Play" pulldown
# menus on the menu bar.
#
# The function ugi_import_iges()
# has the following arguments:
#
# ugi_import_iges
# ( file_name,
# group_name,
# entity_toggle_values,
# color_toggle_values,
# color_method,
# color_definition,
# all_layers,
# layer,
# number_of_groups,
# group_entity_ids,
# group_entity_values,
# group_color_values,
# layer_pointers,
# group_layers,
# scale,
# iges_count,
# patran_count )
#
#---------------------------------------------------------------------
# Variable Declarations
STRING s_file_name[32]
STRING s_group_name[32]
LOGICAL la_entity_toggle_values(35)
LOGICAL la_color_toggle_values(10)
STRING s_color_method[7]
STRING s_color_definition[8]
LOGICAL l_all_layers
STRING s_layer[8]
INTEGER i_number_of_groups = 1
INTEGER ia_group_entity_ids(2)
LOGICAL laa_group_entity_values(20,2)
LOGICAL laa_group_color_values(10,2)
INTEGER ia_layer_pointers(2)
INTEGER ia_group_layers(4)
REAL r_scale
INTEGER ia_iges_count(20)
INTEGER ia_patran_count(8)
INTEGER i_return_value
STRING s_start_section[64]
STRING s_model_units[8]
LOGICAL la_entity_values(7)
LOGICAL l_all_groups
#---------------------------------------------------------------------
# Open the database "plate.db"
uil_file_open.go("plate.db")
#---------------------------------------------------------------------
# Exporting all the entities from plate.db file
# to ’plate_IGES.igs.01’ file.
s_file_name = "plate_IGES.igs"
s_start_section = "File created by exporting plate.db"
s_model_units = "Inches"
la_entity_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE]
l_all_groups = FALSE
ia_group_entity_ids = [1,0]
#
i_return_value = @
ugi_export_iges @
( s_file_name, @
s_start_section, @
s_model_units, @
la_entity_values, @
l_all_groups, @
i_number_of_groups, @
ia_group_entity_ids, @
ia_patran_count, @
ia_iges_count )
dump i_return_value
# Closing the current database ’plate.db’.
uil_file_close.go( )
#---------------------------------------------------------------------
# Opening a new database by name ’new.db’.
uil_file_new.go( "", "new.db" )
$? YES 36000002
#---------------------------------------------------------------------
# Importing all the entities from file ’plate_IGES.igs.01’.
s_file_name = "plate_IGES.igs.01"
s_group_name = "default_group"
s_color_method = "all"
l_all_layers = TRUE
la_color_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, FALSE]
la_entity_toggle_values = [TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, @
FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, @
FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE]
#
i_return_value = @
ugi_import_iges @
( s_file_name, @
s_group_name, @
la_entity_toggle_values, @
la_color_toggle_values, @
s_color_method, @
s_color_definition, @
l_all_layers, @
s_layer, @
i_number_of_groups, @
ia_group_entity_ids, @
laa_group_entity_values, @
laa_group_color_values, @
ia_layer_pointers, @
ia_group_layers, @
r_scale, @
ia_iges_count, @
ia_patran_count )
dump i_return_value
#---------------------------------------------------------------------