Announcements

Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.

Community
Dynamic Blocks Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DIESEL expression - If Statement in a Field

2 REPLIES 2
Reply
Message 1 of 3
Julio_Soto
337 Views, 2 Replies

DIESEL expression - If Statement in a Field

I'm trying to create a field in an attribute that will take the value of a Rotation Parameter and subtract 180 from it, multiplying it by (-1) if the value is greater than 180. This way I can get negative angle values.

 

I thought this might work

 

$(if, $(>, Angle1,180), ((Angle1-180)*-1)),Angle1)

 

but no luck. Is this possible?

2 REPLIES 2
Message 2 of 3

 

$(if,$(>=,$(getvar,Rotation),180),$(*,-1,$(-,$(getvar,Rotation),180)),$(-,$(getvar,Rotation),180))

 

  • $(getvar,Rotation): Retrieves the value of the rotation parameter.
  • $(>=,$(getvar,Rotation),180): Checks if the rotation value is greater than or equal to 180.
  • $(-,$(getvar,Rotation),180): Subtracts 180 from the rotation value.
  • $(*,-1,$(-,$(getvar,Rotation),180)): If the rotation value is greater than or equal to 180, multiply the result by -1.
  • $(if,condition,expr_true,expr_false): The if function evaluates the condition and returns expr_true if the condition is true, otherwise, it returns expr_false.

Maybe this will help

 

Message 3 of 3

No, you cannot use (getvar) for this. Looks like an AI-generated response...

It is not possible to use conditional expressions but you can trick it by using a "magic" math expression in the field. See the tip https://www.cadforum.cz/en/if-statement-in-autocad-text-fields-and-attributes-tip14215 to get something like that:

 

Vladimir Michl, www.arkance.world  -  www.cadforum.cz

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report