Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

two IF statements are true, then do...

22 REPLIES 22
SOLVED
Reply
Message 1 of 23
dtiemeyer
956 Views, 22 Replies

two IF statements are true, then do...

I cant figure out how to check for 2 conditions to be true, then do an action. Can somebody help me out here?

 

I've got a DCL that asks for PRINTER and SIZE

 

I want to do something like this:

if PRINTER=PDF.pc3 and SIZE=A then set variable "PSIZE" to "LETTER"

if PRINTER=PDF.pc3 and SIZE=B then set variable "PSIZE" to "TABLOID"

else 'do not change PSIZE'

 

The variable "PSIZE" is defined higher in the lsp and these would only change it if one of my four printers is the selection.

 

Thank you.

Dustin

My other CAD is a Cadillac and I like to Revit to the Max!
22 REPLIES 22
Message 21 of 23
Gary_J_Orr
in reply to: Gary_J_Orr

After reading my actual post (it was the result of a few different attempts at trying to help noodle through what the OP was trying to do and how to get him there from where he was starting) I'm surprised that the only thing that I was "called on" was that I still had that (and where there should have been an (or (it was left over from my first run trying to show what he was attempting (and (/= ,,,)

Then I notice that I had shown ithe problem as a 4x2 matrix where there was only a 2x2 matrix (2 possible groups of printers x 2 page sizes) at his starting point (it was originally intended to be included later where I ended up showing a 3x2 for possible later expansion)...

I'm surprized that no one called me on that as well... ReallyBigGrin

Now to try to figure out how to edit the post to make it accurate for potential future viewers... hhhmmm...
Gary J. Orr
(Your Friendly Neighborhood) CADD/BIM/VDC Applications Manager
http://www.linkedin.com/in/garyorr

aka (current and past user names):
Gary_J_Orr (GOMO Stuff 2008-Present); OrrG (Forum Studio 2005-2008); Gary J. Orr (LHB Inc 2002-2005); Orr, Gary J. (Gossen Livingston 1997-2002)
Message 22 of 23
dbroad
in reply to: Gary_J_Orr

Gary and Kent,

Let's wait till the OP responds to our latest posts before continuing.  It seems apparent to me that his original needs drastically changed in his latest post.  Until he can explain exactly how many printers he actually has and how many sheet size choices are really anticipated, all of this guessing and coding is possibly pointless.

 

Its a lot different to check whether a printer is equal to something than to check is it is not equal to something. This implies a more complex situation of printers and sheet sizes than he originally anticipated.

Architect, Registered NC, VA, SC, & GA.
Message 23 of 23
dtiemeyer
in reply to: dbroad

Gentlemen,

First let me say thank you to everybody that posted, I'll be giving 'Kudos' shortly. Secondly, I'd like to say that it's been enjoyable seeing the camaraderie amongst you all And my apologies for not expressing my needs clearly enough. In the end, I was able to use Henrique's idea. It gives me the ability to easily make a list of all the printer & page size iterations I need, and is therefore expandable to future needs very easily, which is what I was hoping to acheive. I know it's not as elegant as some people would prefer, but a brute force list is reasonable when there's only a handful of iterations - as is the case here. Here's a snippet of the code I ended up using, and I'll attach the full LISP.  And in response to people's mention of the laughable state this code was in, I can only say, I agree completely - that's what brought me here!  Smiley Happy Cheers all, thanks again. 

 

Code:  (yes, I realize the first 4 listings are redundant, but it keeps it simple for my feeble mind)

(cond 
 ((and (= PRINTER "Electronic - Bluebeam PDF.pc3") (= PSIZE "Letter"))
  (setq PSIZE "LETTER")
  )
 ((and (= PRINTER "Electronic - Bluebeam PDF.pc3") (= PSIZE "Tabloid"))
  (setq PSIZE "TABLOID")
  )
 ((and (= PRINTER "Troy - Printer - Central.pc3") (= PSIZE "Letter"))
  (setq PSIZE "LETTER")
  )
 ((and (= PRINTER "Troy - Printer - Central.pc3") (= PSIZE "Tabloid"))
  (setq PSIZE "TABLOID")
  )
 ((and (= PRINTER "Troy - Printer - Repro Room.pc3") (= PSIZE "Letter"))
  (setq PSIZE "Letter (8.5 x 11\")")
  )
 ((and (= PRINTER "Troy - Printer - Repro Room.pc3") (= PSIZE "Tabloid"))
  (setq PSIZE "Tabloid (11 x 17\")")
  )
 ((and (= PRINTER "Troy - Printer - West.pc3") (= PSIZE "Letter"))
  (setq PSIZE "Letter (8.5 x 11\")")
  )
 ((and (= PRINTER "Troy - Printer - West.pc3") (= PSIZE "Tabloid"))
  (setq PSIZE "Tabloid (11 x 17\")")
  )
 ((and (= PRINTER "Troy - Printer - Southeast.pc3") (= PSIZE "Letter"))
  (setq PSIZE "Letter (8.5 x 11\")")
  )
 ((and (= PRINTER "Troy - Printer - Southeast.pc3") (= PSIZE "Tabloid"))
  (setq PSIZE "Tabloid (11 x 17\")")
  )
 );; cond

 

 

 

My other CAD is a Cadillac and I like to Revit to the Max!

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

Post to forums  

Autodesk Design & Make Report

”Boost