Jump to content

Recommended Posts

Posted

Hi,

 

I'm creating a autolisp routine for drawing ducts.

 

i want to select a point or type in a string

 

with (setq x (getstring "/nPick second point or place transition[T]))

it does nothing when i pick a point on screen

 

 

with (setq p2 (getpoint "/nPick second point or place transition[T]))

it gives me

 

"Invalid point."

 

can i do something with this (error handeling)

or has anybody have a different work-around

Posted

When using getpoint, what are you entering at the prompt for the function to return 'Invalid point.'?

Posted

My english is not so good.

so I hope i understand your question correctly.

 

I type "T" but because autocad is expecting a point it returns "Invalid point"

Posted

(initget 1 "T")
(setq p2 (getpoint "/nPick second point or place transition[T]"))

 

??

Posted

Maybe press enter then point is nil this way you do not mix variables as points or strings

 

 

(setq x (getpoint "/nPick second point or place transition <Cr>))
(if (= x nil) do something now

Posted (edited)

(setq sp (getpoint "\nGive startpoint: "))

 

(while

(initget "v t")

(setq np (getpoint sp"\nGive next point, transition(v) or tee(t)"))

 

(if

(= np "v")

(transition)

)

 

(if

(= np "t")

(tee)

)

 

(duct)

 

)

 

this piece of code works without the while loop.

with the while loop it stops on the initget function.

anybody knows why that is?

Edited by bdw_at_TDE
not completed
Posted

initget always returns nil, so (while is stop working.

Try

(while
  (progn
    (initget "v t")
    (setq np (getpoint sp"\nGive next point, transition(v) or tee(t)"))
  )
  ......

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