Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

relation related inquiry

megaladon

New member
i have several parts attached to a skeleton that has a program in that prompts me to enter what mode i want
mode 1 is flat
mode 2 is folded
mode 3 is flexed

i also have several parts that are affected by the mode

when in mode 2 most of the parts are at their longest.

i need to write a relation for a dimension that regenerates or calculates all three modes and returns the longest length to drive my dimension

in the skeleton i have created an analysis feature measuring the curve length and set my dimension to equal it

i have written this but it is not working

if d12:15==1220
x=length:fid_ctr_lp5:23
endif

if d12:15==1554

y=length:fid_ctr_lp5:23

endif

if d12:15==1879

z=length:fid_ctr_lp5:23

endif

d334=max(x,y,z)

d12 is part of the skeleton that is moving but i do not like using this in the relation because the values could change in the future. they currently represent the length of the cylinder extending.
 
the max() function only takes two arguments i.e. max(x,y). To test three numbers try this:


a=max(x,y)


d334=max(a,z)
 
if d12:0==2262.82758
length:FID_CTR_FP6:11==x
endif


if d12:0==1377.95
length:FID_CTR_FP6:11==y
endif


if d12:0==2343.15
length:FID_CTR_FP6:11==z
endif


a=max(x,y)
d334 = max(a,z)


i didn't know it only calculated two at a time but i still get this error



errorInvalid left side of assignment
 
Is the error showing up in the IF statements? If you are trying to assign values to x, y, and z those variables can't be on the right side of the equation. You're alsousing a logical expression were one isn't expected. Your equations for x, y, and z from before were okay. You could also write the two relations given earlier using max() as one relation. You probably also want to create a statement that sets d334 afterall modes are run.
Edited by: kdem
 
you guys are helping tremendously
here's the latest

IF D12:0==2262.82758
LENGTH:FID_CTR_FP6:3==X
ENDIF
<?:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" />
IF D12:0==1377.95
LENGTH:FID_CTR_FP6:3==Y
ENDIF

IF D12:0==2343.15
LENGTH:FID_CTR_FP6:3==Z
warning[1]Constraint has been violated
ENDIF

a=max(x,y)
max(a,z)==d340
warning[1]Constraint has been violated

i'm not sure what i'm violating but i think i have to regenerate my model 3 or 4 times in each position to get these to go away. is there a command that will prevent this?
 
The problemis LENGTH:FID_CTR_FP6:3 has a different value than Z and max(a,z) has a different value than d340. The statements you have are comparison statements that compareone value toanother and return a value of TRUE or FALSE not a relation that sets one value equal to another. The messages you are getting mean that when you regenrated the model D12:0 was 2343.15, the value LENGTH:FID_CTR_FP6:3 was compared to Z and the values were not the same so the constraint, LENGTH:FID_CTR_FP6:3==Z,is violated.Similar reasoning is applied to themax(a,z)==d340statement.
 
i found it

thank you to all for helping me with this!!!!!!

IF D12:0==2262.82758
X=LENGTH:FID_CTR_FP6:5
<?:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" />
IF D12:0==1377.95
Y=LENGTH:FID_CTR_FP6:5

IF D12:0==2343.15
Z=LENGTH:FID_CTR_FP6:5

A=max(X,Y)
max(A,Z)==D340

ENDIF
ENDIF
ENDIF
 
Assuming d340 is the length of the curve try changing the comparison statement max(A,Z)==D340 to the relation D340=max(A,Z).
 
d340 is the length of the curve. you are exactly right. the below relation works perfectly now


IF D12:0==2262.82758
X=LENGTH:FID_CTR_FP6:11
ELSE


IF D12:0==1377.95
Y=LENGTH:FID_CTR_FP6:11
ELSE


IF D12:0==2343.15
z=LENGTH:FID_CTR_FP6:11


ENDIF
ENDIF
ENDIF


a=MAX(X,Y)
d340=MAX(Z,A)
 

Sponsor

Articles From 3DCAD World

Back
Top