rookie37 Posted May 26, 2010 Share Posted May 26, 2010 I need a lisp routine that will; Prompt me for the ‘Y’ scale (0.379 in this case) Prompt me for the block name (rot 3 in this case) Prompt me for the size (582 in this case) Insert block rot 3 at scale x = 1 y = .379 at position 0,0 Scale block 582 Quote Link to comment Share on other sites More sharing options...
lpseifert Posted May 26, 2010 Share Posted May 26, 2010 Is this a request for someone to write it for you... or just a statement that you need one? Post your attempt at the code and I'm sure some here will help. Quote Link to comment Share on other sites More sharing options...
rookie37 Posted May 27, 2010 Author Share Posted May 27, 2010 Sorry. I guess I was lazy. (defun C:test () (setq echo (getvar "CMDECHO")) (setq OS (GETVAR "OSMODE")) (SETVAR "OSMODE" 0) (setvar "CMDECHO" 0) (setq blokname (getname "\nEnter block name: ")) **rot 3 (setq yvalue (getname "\nEnter Y value: ")) (setq oall (getname "\nEnter overall dimension: ")) (command "-insert" blokname "" y "" yvalue "" 0,0 "" "") (command "scale""l"" oall "" "") (setvar "CMDECHO" echo) (SETVAR "OSMODE" OS) (PROGN) ) Quote Link to comment Share on other sites More sharing options...
lpseifert Posted May 27, 2010 Share Posted May 27, 2010 I'm not quite sure why you need a lisp routine... just follow the prompts from the insert (or -insert) command. Quote Link to comment Share on other sites More sharing options...
rookie37 Posted May 27, 2010 Author Share Posted May 27, 2010 I have hundreds of these to do Quote Link to comment Share on other sites More sharing options...
rookie37 Posted May 27, 2010 Author Share Posted May 27, 2010 (setq blokname (getname "\nEnter block name: ")) getname was only a guess. What is the correct syntax? Quote Link to comment Share on other sites More sharing options...
MarcoW Posted May 27, 2010 Share Posted May 27, 2010 (setq blokname (getname "\nEnter block name: ")) getname was only a guess. What is the correct syntax? That would be: (setq blokname (getstring T "\nEnter block name: ")) 1. watch it: you use bloKname and probably mean bloCKname so do not get confused by this. Better would be to use the right word straight off. 2. Getstring allows to put a word in variable. 3. The "T" is to allow a "space" in the stringname like "This is a test". But ... I need a lisp routine that will;Prompt me for the ‘Y’ scale (0.379 in this case) Okay... Prompt me for the block name (rot 3 in this case) Yep... Prompt me for the size (582 in this case) Insert block rot 3 at scale x = 1 y = .379 at position 0,0Scale block 582 Strange way of doing stuff but okay: ; MarcoW / 27-05-2010 (defun C:Test (/ BlockName CmdEchoOld InsPt OsmodeOld Rot ScaleX ScaleXY ScaleY) (vl-load-com) (setq CmdEchoOld (getvar "CMDECHO") OsmodeOld (getvar "OSMODE") ) (setvar "CMDECHO" 0) (SETVAR "OSMODE" 0) (setq BlockName (getstring T "\nEnter block name: ") InsPt (getpoint "Specify insertion point: ") ScaleX (getreal "\nEnter X scale value: ") ScaleY (getreal "\nEnter Y scale value: ") ScaleXY (getreal "\nEnter overall scaling: ") Rot (getreal "Specify rotation angle of the block : ") ) (vl-cmdf "._insert" BlockName InsPt ScaleX ScaleY Rot) (vl-cmdf "._scale" "_L" "" InsPt ScaleXY) (setvar "CMDECHO" CmdEchoOld) (setvar "OSMODE" OsmodeOld) (princ) ) (princ) Hope it helps! Quote Link to comment Share on other sites More sharing options...
rookie37 Posted May 28, 2010 Author Share Posted May 28, 2010 Thank you very much!!!! And you're right. It is a strange way of doing stuff. I'm not that good at programming and only modify the modified programs that have already been modified How do I update it to pick a block from a certain directory? (one that isn't already in the drawing or in the path? Quote Link to comment Share on other sites More sharing options...
MarcoW Posted May 28, 2010 Share Posted May 28, 2010 Thank you very much!!!! You are welcome. Nice to do something back after all the time people helping me out. I'm not that good at programming and only modify the modified programs that have already been modified THen keep on modifying How do I update it to pick a block from a certain directory? (one that isn't already in the drawing or in the path? You should either build in a *.dcl (dialog box) that gives you the option to browse to the file. Or you should manually enter the right location.... Both are some work and some mouse clicks.... Why not approach it totally different with macro's in a toolpalette or menu (or even toolbar...) Are you familiar with that? I am running out of time now so if I should help you you will need to wait a little.. CU. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.