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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Writing a relation

palex1
1-Visitor

Writing a relation

I need to keep area constant, but able to change either d1 or d2 dimensions.

Any ideas.

thanks

1 REPLY 1

You will need 4 parameters dim1, dim2, previousdim1 &
previousdim2. Make sure when you start that previousdim1 and dim1 are
equal and that previousdim2 and dim2 are equal. Also you will need to
replace the dimensions in the drawings with created dimensions that use
the parameter symbols in place of the dimension. [@o&dim1] in place of
where you want d1 and [@o&dim2] in place of where you want d2.

The way I have done this if you change both values dim1 will trump
dim2, so dim2 will not be maintained to the new value that it was manually
set to. You will only be able to change one dimension at a time, but this
will maintain the balance you are looking for.

area = 400 /* The area you are interested in maintaining. I would put this
as a note on the drawing.
If previousdim1 != dim1 /* Checks if the value of dim1 has changed.
dim2 = area / dim1 /* if the value has changed it modifies dim2 to match
the current value of area divided by dim1 & sets the previousdim2 value
equal to dim2 value.
previousdim2 = dim2
else
endif
If previousdim2 != dim2 /* Checks if the value of dim2 has changed.
dim1 = area / dim2 /* if the value has changed it modifies dim1 to match
the current value of area divided by dim2 & sets the previousdim1 value
equal to dim1 value.
previousdim1 = dim1
else
endif
d1 = dim1
d2 = dim2

Hope that helps,

Brian S. Lynn
Technical Coordinator, Product Engineering
Announcements
Business Continuity with Creo: Learn more about it here.

Top Tags