Inserting blocks with lisp

I am using the following code to insert blocks because it allows me to prompt
for the rotation angle.
(princ "\nSelect insertion point for block: ")
(command "-insert" some_block "s" (getvar "dimscale") pause nil)
(princ "\nRotation angle: ")
(command "-insert" some_block "s" (getvar "dimscale") (getvar "lastpoint")
pause)
The problem is that when there is are running osnaps and an osnap is manually
selected the (getvar "lastpoint") returns the point
picked by the running osnaps. For example with a running osnap of endpoint and
selecting the midpoint of a line the (getvar
"lastpoint") returns the endpoint. Is there another way that I should be doing
this?
Thanks
Cliff
Reply to
Cliff Davis
Loading thread data ...
for the rotation angle.
selected the (getvar "lastpoint") returns the point
and selecting the midpoint of a line the (getvar
Have you looked into using ENTMAKE? If there are no attributes, it should be relatively simple. ENTMAKE allows much more control. It would look something like this:
(initget 1) (setq ipt (getpoint "\nInsertion point: ")) (initget 1) (setq rpt (getpoint ipt "\nPick orientation point: ")) (setq insang (angle ipt rpt)) (entmake (list '(0 . "INSERT") (cons 2 "BlockNameHere") (cons 10 ipt) (cons 41 5.0) ;X scale (cons 42 5.0) ;Y scale (cons 43 5.0) ;Z scale (cons 50 insang) ));list, entmake (entmake (list '(0 . "SEQEND")))
Repost if you need some explanation.
Reply to
TomD
I have in the past, but it doesn't allow a graphic representation of the block while inserting. Thanks Cliff
prompt for the rotation angle.
manually selected the (getvar "lastpoint") returns the point
and selecting the midpoint of a line the (getvar
Reply to
Cliff Davis
while inserting.
How about this:
(setq oldos (getvar "OSMODE")) (setvar "OSMODE" 0) ;insertion here (setvar "OSMODE" oldos)
Reply to
TomD
Almost forgot another way I've done similar things.........Insert the block, then issue the "CHANGE" command, pausing for the user selection.
Reply to
TomD
Here is a way of doing it also. This is a slight modification of the way I do it. It is a scaled insert command.
(defun c:scldinsrt () (setq insblknm (getstring "\nEnter Block Name...")) (setq sc (getvar "dimscale")) (command "-insert" insblknm "scale" sc pause) (princ) ) This works great for me. I can use running osnaps or manual snaps. Good Luck -- Darek D. Watson CAD Manager
prompt for the rotation angle.
"lastpoint") pause)
manually selected the (getvar "lastpoint") returns the point
endpoint and selecting the midpoint of a line the (getvar
Reply to
Darek D. Watson
TomD wrote in news: snipped-for-privacy@stargate.net:
this works because it snaps to the over ride osnap and processes that result to the running mode.
like, you want the midpoint, you select the midpoint and THEN autocad takes that point and applies the endpoint osnap to that, ending up with the endpoint.
right?
Reply to
Roy Knapp

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.