November 2006
Knowledge Base Exclusive


Suggested Technique for Using Pro/PROGRAM to Pass Variable Information through an Assembly

 

The following demonstrates how to pass variable information from an assembly level to the next-lower-level of the assembly using Pro/PROGRAM. This technique can be used to pass down information controlling component or part placement, part or feature dimensions and parameter information.

In this particular example, the user at the assembly will be prompted for the width dimension of the component "BLOCKB." This allows you to input the desired width of the component rather than having to modify the dimension by manually picking and changing it. A number of parameters or dimensions can be prompted at the beginning of the regeneration, and all of them will be implemented at once:

 

First, the symbols for the dimensions that are to be controlled must be determined. 

 

  • Activate the required components and hold the right mouse button, then click Edit to show the dimensions for the features or components. Figure 1 shows the dimensions which will be used to control the width and placement of BLOCKB.
  • Select Info > Switch Dimensions so that the dimension symbols display on the screen (Figure 2). Make a note of the dimension symbols. 
  • To edit the assembly's program, click Tools > Program > Edit Design. The following is the code for the assembly level program:  

    • The INPUT section of the assembly program prompts you for the desired dimension for the width of BLOCKB.  
    • The RELATIONS section ensures proper placement of BLOCKB through the use of the dimension symbol "d0:1."  
    • The EXECUTE statement near the end of the program passes pertinent information on.  

  • Add the lines that are underlined below to the program.

VERSION 2.0
REVNUM 124
LISTING FOR ASSEMBLY PROG_ASM

INPUT
WIDTH_OF_B NUMBER
"What is the width of block B?: "
!You are prompted for a value for the variable WIDTH_OF_B

END INPUT
RELATIONS
d0:1 = WIDTH_OF_B * .5
!The line above sets the dimension symbol d0:1 equal to 1/2 of the value of WIDTH_OF_B.
This relationship is here to keep block B positioned correctly
END RELATIONS
ADD FEATURE (initial number 1)
INTERNAL FEATURE ID 1
TYPE = DATUM PLANE
NAME = ADTM1
END ADD 
ADD FEATURE (initial number 2)
INTERNAL FEATURE ID 3
TYPE = DATUM PLANE
NAME = ADTM2
END ADD
ADD FEATURE (initial number 3)
INTERNAL FEATURE ID 5
TYPE = DATUM PLANE
NAME = ADTM3
END ADD
ADD FEATURE (initial number 4)
INTERNAL FEATURE ID 7
PARENTS = 3(#2) 5(#3)
TYPE = DATUM AXIS
NAME = AA_1
END ADD
ADD FEATURE (initial number 5)
INTERNAL FEATURE ID 11
PARENTS = 1(#1) 5(#3)
TYPE = DATUM AXIS
NAME = AA_2
END ADD
ADD FEATURE (initial number 6)
INTERNAL FEATURE ID 15
PARENTS = 1(#1) 3(#2)
TYPE = DATUM AXIS
NAME = AA_3
END ADD
ADD FEATURE (initial number 7)
INTERNAL FEATURE ID 19
TYPE = COORDINATE SYSTEM
NAME = ACS0
END ADD

EXECUTE PART BLOCKB

WIDTH_OF_B = WIDTH_OF_B
!The key part of passing information to the next-lower-level
of the assembly is the above execute statement.


END EXECUTE
ADD PART BLOCKB
INTERNAL COMPONENT ID 30

END ADD
ADD PART BLOCKA
INTERNAL COMPONENT ID 27
END ADD
MASSPROP
END MASSPROP

The EXECUTE statement forms the link to the next-lower-level component generic model, which in this case is the part BLOCKB.PRT. The information contained within the EXECUTE - END EXECUTE has the following format:

Next_lower_level_variable_name = Current_level_variable_name

In this case, the same variable name and value is passed down to the component BLOCKB.PRT.

In the next-lower-level generic component, in this case BLOCKB.PRT, an INPUT statement must be added to the INPUT section of the program which is the same as the left hand side of the equation in the EXECUTE statement:


NOTE: The following is placed in the next-lower-level component generic program.

INPUT
WIDTH_OF_B NUMBER
END INPUT
RELATIONS
D1 = WIDTH_OF_B
!The line above sets the dimension symbol d1 equal to the value of the input
D3 = D1 * 0.5
!The line above sets the dimension symbol d3 equal to half of d1 for location of the "B" protrusion
END RELATIONS

The above RELATIONS section in the part program now uses the variable information which was input into WIDTH_OF_B to drive the dimension D1, and then subsequently D3.

Once the programs are edited and saved in both the assembly and next-lower-level models, the assembly may be regenerated. 

  • Select Edit > Regenerate > Enter. Select the appropriate parameters from the INPUT SEL menu and enter the desired value. (Figure 3

In this example, WIDTH_OF_B was selected, and a value of 100 was entered. The result is shown in Figure 4.

 

 


This is a sample of the wealth of material you can find in PTC's technical Knowledge Base. You can gain complete access to the Knowledge Base by becoming an active maintenance customer. Learn more

 


Was this Knowledge Base Exclusive tip helpful? Let us know.






[PRINTER FRIENDLY VERSION]
HOME

Moldbase Design Made Easy
PTC Updates
Tips of the Month
Knowledge Base Exclusive
Webcasts & Events
Pro/ENGINEER Gets Its Game On


Figure 1


Figure 2


Figure 3


Figure 4


 

Contact PTC | Privacy Policy | PTC Express Archive | Subscribe | Unsubscribe | Change Preferences | Edit Profile

This e-mail was sent to:   PTC, 140 Kendrick Street, Needham, MA 02494 USA
If you are unable to read this page correctly, please click here.