Gratitude1977 Posted November 18, 2010 Posted November 18, 2010 Hi all, Just wondering if anyone would happen to have a lisp routine or help my out with writing a routine that would scale blocks upon insertion. I have all my blocks being inserted with a macro, I have them at 1:1. I am looking to have the blocks scaled at 1"=10' and so on. I am working in model space and am using Autcad 2005. Any and all help would be huge. Thanks:D Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 This can be done by adding a "\" (or pause for user input) within your existing macro, instead of force inserting @ 1:1. Or you could simply create a separate macro (button) for each scale desired; either way, it's your call. Post your macro code if you need help modifying. Hope this helps! Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 Perhaps this will accomplish what you want, if you choose to go with LISP instead of a macro: (defun c:[color=red]FOO[/color] (/ pt) (prompt "\n >> Specify Insertion Points: ") (while (/= nil (setq pt (getpoint))) (command "._-insert" "[color=red]YourBlockName[/color]" pt pause "" pause)) (princ)) This will pause for both user input for the block's scale, but also the blocks rotation. Quote
Gratitude1977 Posted November 18, 2010 Author Posted November 18, 2010 Thanks for the advice Renderman, I am interested in the second Macro (button) that you are talking about. I have noted that the blocks are set at a perfect size for 1/360xp (1"=30") would you be able to help me with the Macro as I am very rusty with macro's as I have been out of the game for a while. This is the macro I have right now for inserting the blocks.....^C^C-la;set;generalplumbingstack;;-insert;plumbingstack . I require this second macro to change the scale as per the drawing scales. example 1"=10' and so on. Any help starting this macro would be great> Thanks Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 Try saving this code to a text file named MyInsert.lsp (be sure to remember where you save this file): (defun c:MyInsert (/ *error* oldLayer layerName pt) ;; Error handler (defun *error* nil (if oldLayer (setvar 'clayer oldLayer))) ;; Main code (setq oldLayer (getvar 'clayer)) (if (not (tblsearch "layer" (setq layerName "generalplumbingstack"))) (command "._-layer" "_new" layerName "")) (setvar 'clayer layerName) (prompt "\n >> Specify Insertion Points: ") (while (/= nil (setq pt (getpoint))) (command "._-insert" "plumbingstack" pt pause "" 0)) (setvar 'clayer oldLayer) (princ)) Then, create a new command within the CUI editor (for testing), and add this macro code: ^C^C^P(if (not c:MyInsert)(load "[color=red]FilePath[/color]\\MyInsert.lsp"));MyInsert Also, you can add this to ACADDOC.lsp, and the user will now have the option of entering the command at the command line: (load "[color=red]FilePath[/color]\\MyInsert.lsp") This is a really simple tool, that will allow you to grow and customize as you become more proficient. Hope this helps! Quote
Gratitude1977 Posted November 18, 2010 Author Posted November 18, 2010 Thanks again, So how will this routine help with the scale issues I am having? What I mean is how will this work on changing the blocks scale from 1:1 to 1"=10' and so on. Sorry for the repeat questions but I am really having a hard time grasping how to get the blocks scale changed. Thanks again. Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 So how will this routine help with the scale issues I am having? What I mean is how will this work on changing the blocks scale from 1:1 to 1"=10' and so on. Sorry for the repeat questions but I am really having a hard time grasping how to get the blocks scale changed. No worries; have you tried the code? What I provided you does exactly what your original macro does, inserting a specific block on the desired layer, and then some.... ... Specifically, the 'and then some' means: *error* checking is provided, so that if the user were to escape/*error* out before the routine is finished, the layer is changed back. A layer check is performed, so that if the layer does not exist it will be created This routine will allow to the user to insert the predefined block multiple times (if desired) The routine pauses for user input, so that the user enters the desired scale of the block as it is being inserted (instead of re-scaling it after your macro is done, i.e., less work) Please let me know if I have misunderstood your question(s). Quote
Lee Mac Posted November 18, 2010 Posted November 18, 2010 Why not use Tool Palettes? All this functionality is already there. Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 Why not use Tool Palettes? All this functionality is already there. Agreed... I was simply trying to provide the OP with a better (more complete?) option then using simple, error prone Macros without giving up their buttons. :shrug: Quote
Gratitude1977 Posted November 18, 2010 Author Posted November 18, 2010 Sorry guys, I guess I am making this more confusing than it should be. Here it is again, I have a symbols library. I created those macros to insert them, where I am having issues is how to have the blocks scaled for the appr. scale of the drawing, Ie. drawn building, paperspace scale is 1"=10'. so 1/120xp I need to have a macro or something to that effect that will change the blocks to that scale before I insert them in model space. Hope that clears it up because I am more confused now! lmao! And again thanks. Really appr. the help and time you are taking. Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 You have already been provided two options to accomplish this simple task: LISP code for command line, and button entry Tool Palettes Good luck! Quote
Lee Mac Posted November 18, 2010 Posted November 18, 2010 Tool Palettes are definitely the way to go - and they are much simpler to create than the toolbars/buttons. Once created, you can set a specific scale/rotation/layer etc for each symbol in your library and furthermore, there is no macro to mess around with. If you need help creating them, just shout. Here is a good tutorial for 2005 (which I believe you are using). http://www.sketch-plus.com/CAD_Tutorials/AutoCAD_2005-lesson_16-Introduction_to_Tool_Palettes.html FYI: He says you have to 'drag' the blocks from the tool palette into the drawing to insert them - you don't: just click on the block icon and it can be inserted. You can also add blocks using the Design Center, which can sometimes be easier. Quote
Gratitude1977 Posted November 18, 2010 Author Posted November 18, 2010 I did not mean to sound greedy. I am sorry about the many questions. The only issue I had was scaling of blocks upon insertion. Thanks for the help. I will use all ideas and options to help me figure this out. Quote
Lee Mac Posted November 18, 2010 Posted November 18, 2010 I did not mean to sound greedy. I am sorry about the many questions. The only issue I had was scaling of blocks upon insertion. Don't worry, you didn't (or at least I didn't think so) Thanks for the help. I will use all ideas and options to help me figure this out. You're welcome - if you need any further help, shout Quote
Gratitude1977 Posted November 18, 2010 Author Posted November 18, 2010 Update, I ended up creating 4 toolbars with the same blocks on each, the difference is that each toolbar has a different scale for the blocks. That is what I needed and that is how I did it. Took a little longer but it works. Thanks again for the help. Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 I did not mean to sound greedy. I am sorry about the many questions. The only issue I had was scaling of blocks upon insertion. Don't worry, you didn't (or at least I didn't think so) Please do not take my silence as agreement; questions are welcome anytime. I am simply very busy with migrating our entire system and active projects over to our new server, whilst remaining productive with project work. Quote
Lee Mac Posted November 18, 2010 Posted November 18, 2010 Update, I ended up creating 4 toolbars with the same blocks on each, the difference is that each toolbar has a different scale for the blocks. That is what I needed and that is how I did it. Took a little longer but it works. Thanks again for the help. Just curious - why did you avoid the tool palettes? - just seemed the easiest solution to me. Quote
BlackBox Posted November 18, 2010 Posted November 18, 2010 Why not use Tool Palettes? All this functionality is already there. Agreed... I was simply trying to provide the OP with a better (more complete?) option then using simple, error prone Macros without giving up their buttons. :shrug: Update, I ended up creating 4 toolbars with the same blocks on each, the difference is that each toolbar has a different scale for the blocks. That is what I needed and that is how I did it. Took a little longer but it works. Thanks again for the help. I'm always happy to not help. lmfao Quote
Gratitude1977 Posted November 22, 2010 Author Posted November 22, 2010 Sorry for not replying before, I am creating this standard in the office and my boss requested it be done this way. I would have much rather used the palette as this would have saved me loads of time and energy. I have it working and again I really appr. all the advice and help. Not in anyway mad or trying to make anyone think i am ungrateful. Thanks again! Quote
alanjt Posted November 22, 2010 Posted November 22, 2010 Sorry for not replying before, I am creating this standard in the office and my boss requested it be done this way. I would have much rather used the palette as this would have saved me loads of time and energy. I have it working and again I really appr. all the advice and help. Not in anyway mad or trying to make anyone think i am ungrateful. Thanks again! Did you try suggesting TP to your boss? Just because they're in charge, doesn't mean they know what's best or can't be persuaded. Quote
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.