Jump to content

Princ prints twice - Not sure why


CivilTechSource

Recommended Posts

Hi Everyone, I have this piece of lisp that I have written and for some reason it prints twice the result following the if checks. Any ideas why?

 

  (if (< PipeClearance 0)
    (progn
      (command "color" "10")
      (command "circle" intpt 0.5)
      (princ "\nYou messed up! Pipe Clash! Pipe Clash!")
    )
  (if (and (> PipeClearance 0) (< PipeClearance Clearance))
    (progn
    (command "color" "50") 
    (command "circle" intpt 0.5)
    (princ "\nOhhhh Pipes Very Close")
    )
    
    (progn
    (command "color" "80")
    (command "circle" intpt 0.5)
    (princ "\nAll Pipes are Clear")
    )
  )
  ;----
  )

 

Link to comment
Share on other sites

Hi @CivilTechSource,

 

You need to add a (princ) (choose one of these):

- the first one you can add (princ) inside of each "progn" after (princ "\nOhhhh.....) and (princ "\nAll.....)

- the second one you can add (princ) after "if" statement, before or after ";----" in your code.

Adding a (princ) you will get a "clean" output in command line.

Edited by Saxlle
  • Like 1
Link to comment
Share on other sites

@CivilTechSource you dont need to start a new topic this request can be added to your other post.

 

Admin please merge into other post. 

 

Just  a comment as your using multi if's it is probably better to start coding using a COND. 

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...