Jump to content

Controling Parameters via Programing


mts5143

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

para.jpg

SuperImposed.dwg

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...