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

Insertion point problem

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
aqdam1978
522 Views, 11 Replies

Insertion point problem

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,

 

Tags (3)
11 REPLIES 11
Message 2 of 12
_Tharwat
in reply to: aqdam1978

(defun c:Hold (/ p )
  (if (setq p (getpoint "\n Specify point :"))
    (command "_.-insert" "<Should put complete path of the Drawing>" "_non" p "" "" "")
    )
  (princ)
  )

 

Message 3 of 12
hgasty1001
in reply to: aqdam1978

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

Message 4 of 12
aqdam1978
in reply to: _Tharwat

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.

Message 5 of 12
Moshe-A
in reply to: aqdam1978


@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

 

 

Message 6 of 12
aqdam1978
in reply to: Moshe-A

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!

Message 7 of 12
pbejse
in reply to: aqdam1978


@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

 

Message 8 of 12
Moshe-A
in reply to: pbejse


@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)

 

Message 9 of 12
pbejse
in reply to: Moshe-A


@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?

 

 

 

Message 10 of 12
dicra
in reply to: pbejse


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

Message 11 of 12
Moshe-A
in reply to: pbejse

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

 

Message 12 of 12
pbejse
in reply to: Moshe-A


@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

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

Post to forums  

Autodesk Design & Make Report

”Boost