Hi,
I want to insert "HOLD.DWG" to current open drawing.
I use this LISP function:
(defun c:HOLD()
(setq w t)
(while w
(setq a (getpoint "\npick point:"))
(command "INSERT" "*HOLD" a "" "" "0")
)
(if (= a nil)(setq w nil))
)
but when I picked a point as a insertion point, then block (HOLD.DWG) inserted in another point!
does anybody knows why?
Thanks,
Solved! Go to Solution.
Solved by hgasty1001. Go to Solution.
(defun c:Hold (/ p ) (if (setq p (getpoint "\n Specify point :")) (command "_.-insert" "<Should put complete path of the Drawing>" "_non" p "" "" "") ) (princ) )
Hi,
In addition to use the full path to the file, you should check the base point of the dwg you are inserting (command Base)
Gaston Nunez
Hi _Tharwat,
Thankyou for your help.
I used (command "insert" "*HOLD" p "" "" 0) and it works.
But I'm wonder why you:
1- used: "_.-insert" instead of "insert"?
2-used: "_non" as an extra argument?
Thank you.
@aqdam1978 wrote:Hi _Tharwat,
Thankyou for your help.
I used (command "insert" "*HOLD" p "" "" 0) and it works.
But I'm wonder why you:
1- used: "_.-insert" instead of "insert"?
2-used: "_non" as an extra argument?
Thank you.
Are you aware that puting an asterisk in front of the block name means inserting an exploded copy
of the block and you can not respond to XScale factor and YScale factor separatly?
which mean you got an extra enter argument in (command) function?
and your command does not work.
Moshe
Hi Moshe-A,
Yes, you are right, I changed to:
(defun c:Hold (/ p )
(if (setq p (getpoint "\n Specify point :"))
(command "insert" "*HOLD" p 1 0)
(princ)
)
I test it, It works!
@aqdam1978 wrote:Hi _Tharwat,
Thankyou for your help.
I used (command "insert" "*HOLD" p "" "" 0) and it works.
But I'm wonder why you:
1- used: "_.-insert" instead of "insert"?
2-used: "_non" as an extra argument?
Thank you.
"_" International Language Considerations
"." redefine if the "insert" command happens to be "undefine"
(defun c:HOLD () (while (setq p (getpoint "\npick point:")) (command "_.INSERT" "*HOLD" "_non" p 1 0) ) )
HTH
@Moshe-A wrote:
@pbejse wrote:"_" International Language Considerations
"." redefine if the "insert" command happens to be "undefine"
HTH
minor correction:-
".insert" does not redefine the "insert" command it only ensure the invokation of real INSERT command
(and not the redefined vesion)
Moshe-A.
Can you show me an instance where you can use "insert" other than the native (real) "INSERT" command when the native "INSERT" command is not undefine?
@pbejse wrote:
@aqdam1978 wrote:Hi _Tharwat,
Thankyou for your help.
I used (command "insert" "*HOLD" p "" "" 0) and it works.
But I'm wonder why you:
1- used: "_.-insert" instead of "insert"?
2-used: "_non" as an extra argument?
Thank you.
"_" International Language Considerations
"." redefine if the "insert" command happens to be "undefine"
(defun c:HOLD () (while (setq p (getpoint "\npick point:")) (command "_.INSERT" "*HOLD" "_non" p 1 0) ) )
HTH
And, if I am write, the "-" sign in front of command is used when you don't want to use dialog format of the command.
pbejse,
Pesonally i never seen one undefine insert command but i (we all) always use ".insert"
to make sure our lisp program will bumped into environment where some one myte do
some thing like this:
command: undefine insert
(defun c:insert () (command "copyclip" pause "pasteclip" pause))
"." redefine if the "insert" command happens to be "undefine"
all i meant: that using ".insert" does not redefine the native insert command.
moshe
@Moshe-A wrote:pbejse,
Pesonally i never seen one undefine insert command but i (we all) always use ".insert"
to make sure our lisp program will bumped into environment where some one myte do
some thing like this:
command: undefine insert
(defun c:insert () (command "copyclip" pause "pasteclip" pause))
"." redefine if the "insert" command happens to be "undefine"
all i meant: that using ".insert" does not redefine the native insert command.
moshe
My point is you cannot use a native autocad name for a lisp function without first "undefining" the "real" native command as per your example.
......only ensure the invokation of real INSERT command....
Without undefining the "real" command, the snippet above wont worked at all. so there is no danger of invoking the "real" command.
Hence. for the "." to make any difference you will first need to undefine which brings us back to "redefine" as you define the function "insert" to do something else.
I guess the word were looking for is "activate" then.
Happy Holdiays Moshe-A
Cheers