Jump to content

Recommended Posts

Posted

Hi

I'm new to writing lisp.

 

How can I get the lisp to ascertain the current dimscale and insert the

block I am inserting as a multiple of the dimscale ?

 

Here is the current lisp as it stands:

 

(defun c:2011-insert-sm ()

(setq clay (getvar "clayer"))

(setq *ERROR* MyError)

(command "-layer" "m" "025txt" "")

(command "insert" "Dynamic_Section_Mark-2009" pause "1" 1 0)

(setvar "clayer" clay)

(princ)

)

 

 

Thanks in advance

 

Koal Bee

Posted

Would the multiple be static or variable?

Posted

Hi

The multiple would just be the current dimscale at the time .... so would need to be picked up by looking at the dimscale each time the command is run.

 

thanks

Posted

Sorry Remark .. do I add this in the lisp ?

If so how do I put in the instruction to multiply by the dimscale.

As I said, it's all new to me and the current lisp has been copied from another file

 

Thanks again

Posted (edited)

Check this out Buddy .:)

 


(defun c:2011-insert-sm (/ clay *error* DScale)
(setq clay (getvar "clayer"))
(setq *ERROR* MyError)
(command "_.-layer" "m" "025txt" "")
(while
 (setq DScale (getint "\n Enter scale factor for Block Insertion :"))
 (command "_.-insert" "Dynamic_Section_Mark-2009" pause DScale DScale 0)
 )
(setvar "clayer" clay)
(princ)
)

Tharwat

Edited by Tharwat
Y stretch for block modified
Posted

Is this you need? I just add some lines, some remove and write relevant error handler.

 

(defun c:2011-insert-sm (/ clay cScl *error*)

 (defun *error*(msg)
   (setvar "clayer" clay)
   (setvar "CMDECHO" 1)
   (princ)
   ); end of *error*
 
(setq clay (getvar "clayer")
     cScl(getvar "DIMSCALE")
     ); end setq
(princ(strcat "\nCurrent DIMSCALE = " (rtos cScl 2 2)))
(setvar "CMDECHO" 0)
(command "-layer" "m" "025txt" "")
(command "-insert" "Dynamic_Section_Mark-2009" "_s" cScl pause 0)
(setvar "CMDECHO" 1)
(setvar "clayer" clay)
(princ)
)

Posted

Hi

Tharwat - your lisp brings in the block but seems to stretch it one directiom only, does it need to add something added to scale it in all directions ?

 

Smirnoff - your lisp returns the following message :

Error: malformed list on input

Command: Unknown command "2011-INSERT-SM". Press F1 for help.

 

Thanks for helping guys ... any further ideas ?

 

Koal Bee

Posted
Hi

Tharwat - your lisp brings in the block but seems to stretch it one directiom only, does it need to add something added to scale it in all directions ?

 

Thanks for helping guys ... any further ideas ?

 

Koal Bee

 

Codes updated Koal Bee :)

 

Tharwat

Posted
Smirnoff - your lisp returns the following message :

Error: malformed list on input

Command: Unknown command "2011-INSERT-SM". Press F1 for help.

 

Thanks for helping guys ... any further ideas ?

 

I think you missed the first or the last bracket in copying. Please try again. Either you have the file there is another code with missed bracket. This code is working.

Posted

Smirnoff / Tharwat ...both routines work a treat ..... it was my error ...missing bracket

 

Thank you very much for your help

Hopefully I can help you guys out one day ... but I doubt it !!

 

thanks again

 

Koal Bee :D

Posted

Thanks again ... may have some more stuff requiring your guidance soon

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