cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

AsmCompConstraint setup for CSYS to CSYS assembly

msteffke
13-Aquamarine

AsmCompConstraint setup for CSYS to CSYS assembly

I have a component assembled into a top level assy.   I have successfully read the component constraints using ProAsmcompCnstraintsGet.   Constraint Type is CSYS.      I want this to be a different Csys.  (Of which I have the handle)  How do I set  which csys to reference  in the Proasmcompconstraint datastructure..  Typically csys to csys needs no further constraint data.

 

Does anyone have any sample code dealing with assemblycompconstraint.  TK example is very limited on this topic.   

1 REPLY 1
RPN
17-Peridot
17-Peridot
(To:msteffke)

The answer is with some copy from the wiki.
Target is the assembly where you want to add a new component or assembly.

Soure is the Part or the assembly which you want to insert into the target.

  1. Component Path
    If you assemble a component and you use a csys of the target assembly, no comp path needed
  2. if you assemble an assembly and both csys are in the root level of both assemblies, no comp path needed

In any other case, you have to setup the comp path data.

Assemble a Component

Example: Assembly by CSYS

If you assemble by Coordinate system, you can use the name of the CSYS to identify the model item. Like in Creo you have to specify the assembly reference and the component reference.

For placing Components (single model or another assembly) in one assembly you need to specify the target assembly, the component/assembly to assembly and an initial matrix.

The return value on placing a component is a model item, which contains the component info, for feature id and type and the Assembly owner.

 

We assembly the component 'comp.prt' by using the coordinate system with the name 'CS0' into the assembly 'assy.asm' by using the coordinate system with the name 'ACS0'.

You must supply the same info, as if you would do this in Creo manually.

Basically a selection object contains a component path and a model item reference, this must be supplied by your calls. Component Path is not required in the following example.


You need to supply a component path if you would like to use a reference in the target assembly, which is for example a csys of an already assembled component, or you want to use a csys in one component in the source assembly.

 

Note: A component can be assembled multiple times, the component path will uniquely identify the model item in an assembly component.

 

Herr Tcl Code, C Code is very similar, maybe more to write.

 

 

#
# Vars for the models to be used
# model handle
#
 
set ASSY assy.asm
set PART comp.prt

# Create two selection objects
# including named model items
# one for the assembly reference 
# one for the component reference

ps_sel AssySelObj -modelitem AssyMiObj
ps_sel CompSelObj -modelitem CompMiObj


# A csys for sure has a name
# Note: The Feature ID of the CSYS is not the ID, which is used later
# The Geometric ID will be used
# set data, fill csys geometric id, type and owner.
#
# one for the assembly
# one for the component

# This two calls will setup the model items with valid values
# if the given name and type is valid

AssyMiObj byname $ASSY csys ACS0
CompMiObj byname $PART csys CS0

#
# create the constraint Object
#
ps_asmconstraint constraintObj
 
#
# setup the type by 'csys'
#
constraintObj         config -constrainttype   CSYS
#
# set the info, same as manually done in Creo after selecting the references
# Could be done in one statement as well
#
constraintObj         config -asmselection   AssySelObj -asmdatumside none
constraintObj         config -compselection  CompSelObj -compdatumside NONE

#
# Create a default matrix for initial position
#
ps_matrix matrixObj

#
# Assemble the component first without any constraints
# You only have to take care that 
# 'PlacedMiObj' does not exists as a command with another type.
# You can create it upfront as well, same for the Matrix Object
# 
ps_assy assemble -model $ASSY -- $PART matrixObj PlacedMiObj

# Final call to set the constraints
# We don't need to specify a component path in this sample 
# Only 2 (not 3) args given to the function
# 'PlacedMiObj' is the result from assembling without constraints
# this uniquely identifies the component to configure 
# 'list' is used to keep in mind that you may need to specify more the one constraint
# If you assembe by datum planes you need to supply normally 3 constraints 
#
# If this fail, you may want to delete the placed component with ps_feat delete ?ID? 
# The feature id you get with: 'PlacedMiObj cget -id'
#
# Configure the placed component to make if fully parametric
#
ps_assy setconstraints PlacedMiObj  [list asmconObj] 

#
# Component is now fully constraint and assembled 
#

 

 

Top Tags