mts5143 Posted March 11, 2013 Posted March 11, 2013 I created a drawing that varies hole spacing on a peice of angle iron using parameters,but it would be very beneficial to incorporate if-then statements to control the value of some of parameters based on the value of other parameters. An example of this is, if d1 parameter = 14 then d2parameter = 3 elesif d1 parameter = 15 then d2 parameter = 2. I got this idea from iLogic in Inventor, which is very easy to use. Im aware AutoCAD does not have this functionallity, but I think programing such as VBA could help me with my issue. I do not have a strong programing backround so any advise is appretiated. Quote
BIGAL Posted March 12, 2013 Posted March 12, 2013 Stay with lisp pretty easy (setq d1 (getreal "\nEnter d1 value")) (cond ((= d1 14)(setq d2 2)) ((= d1 15)(setq d2 3)) .. and so on ) you may be able to add a iniget that checks for valid entry only 14 15 16 17 Quote
mts5143 Posted March 13, 2013 Author Posted March 13, 2013 It seems to me that I will have to run the command after I enter d1 to update d2. Is there any way to have d2 update as I enter an input for d1 and not have to separately run a command? Quote
mts5143 Posted March 14, 2013 Author Posted March 14, 2013 Ok. Forgive me. Im not to fluent with lisp. Can you give me a little more direction. I know how to enter it into a notepad, name it, and load it. After its loaded it promps me to enter a value. but does not change my d2. Aside from it not functioning correctly, am I going to have to run it everytime I want to update my d2 after I changing d1, or will d2 automatically update after I enter d1 after the first time I run the lisp. Quote
BIGAL Posted March 15, 2013 Posted March 15, 2013 Copy and paste this into notepad save as say test.lsp then APPLOAD test.lsp follow prompts use 14 or 15 (setq d1 (getreal "\nEnter d1 value")) (cond ((= d1 14)(setq d2 2)) ((= d1 15)(setq d2 3)) ((> d1 15)(princ "Greater than 15")) ((< d1 14)(princ "less than 14")) ) (princ (strcat "the value of d2 is " (rtos d2 2 0))) (princ) Quote
BIGAL Posted March 15, 2013 Posted March 15, 2013 Mts5143 just realised your talking about constraints here aren't you ? not a program thats something different all together post a screen grab with what you have Quote
mts5143 Posted March 15, 2013 Author Posted March 15, 2013 Yes I am talking constraints. Sorry for the confusion. When I change o_COIL_DIMENSION to 15 the "Red" Fastener is to close to the plate so I would like to move it by 1" downward. Same goes for when o_COIL_DIMENSION = 16, in result I would like to move it 2" downware. You can play around with the o_COIL_DIMENSION value to see what I am talking about. If I were in inventor I would write a code in iLogic as follows, but I am trying to find a work around in autocad becuase autocad does not have iLogic. If o_COIL_DIMENSION =15 then d48=4 elseif o_COIL_DIMENSION =16 then d_48=5 End if I have supporting files attached. SuperImposed.dwg Quote
BIGAL Posted March 16, 2013 Posted March 16, 2013 JD reading this ? constraints has a lot of stuff you can do I just don't use enough did you read the help section ? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.