SwervinCL Posted September 25, 2008 Posted September 25, 2008 This is driving me crazy. For whatever reason I can not get this routine to work correctly and its probably the easiest routine ever. I used to use this code all of the time. I am actually thinking it is a attribute that is wrong and not within the code itself. All I want the routine to insert a block. The routine as it is right now works, but it then ask me for the scale factor and rotation. I have to just enter through them. I just want it to insert the block with the scale factor and rotation to be default. I don't want to enter through them every time. Here is the code. (defun C:30AL () (command "-insert" "30AL" "" "" "")) Quote
Strix Posted September 25, 2008 Posted September 25, 2008 have you tried inserting a non-attibute block with the 'same' code? Quote
Lee Mac Posted September 26, 2008 Posted September 26, 2008 I would try to insert the block manually, using the "-insert" command, and see what prompts appear when inserting the block. If the prompts adhere to your code then there should be no reason why the code should not work. However, in saying that, I have tried a few LISPs that insert blocks and find them very temperamental - sometimes, ACAD will not be able to find the correct block, or sometimes, when inserting a different block, ACAD will just insert a block that was previously inserted. Let me know if this helps in any way. Cheers Lee Quote
neekcotrack Posted September 26, 2008 Posted September 26, 2008 (defun C:30AL () (command "-insert" "30AL" "" "" "")) The reason it's not working, is because you did not specify the scale of the block. Here is a few ways of doing this: One, (command "_.insert" "30AL" "s" "1" "r" "0" pause)) This is inserting the block at the scale it was made, and with no rotation option. Two, (command "_.insert" "30AL" "s" "1" pause pause)) This is inserting the block at the scale it was made, and with a rotation option. If it was up to me, and your block was made 1:1. I would replace the "1" with (getvar "dimscale"), so it scales the block to your dimscale. If it's not 1:1 and you still want to do it this way we can amek it scale the block to 1:1 then scale it back up by the dimscale if you like. If you have anymore questions feel free to ask. Quote
SwervinCL Posted September 26, 2008 Author Posted September 26, 2008 I miss-worded my last post. My block is not attributed. I meant to say that I think it has something to do with a variable. If I insert with "-insert", it find the block fine but it is still prompting me for scale factor and rotation. I have the working file support path set to where my blocks are, so cad finding the block is not the issue. Its the rotation and scale factor that I don't want to have to enter through each time. Why does cad have to be so temperamental sometimes.. UGH Quote
SwervinCL Posted September 26, 2008 Author Posted September 26, 2008 (defun C:30AL () (command "-insert" "30AL" "" "" "")) The reason it's not working, is because you did not specify the scale of the block. Here is a few ways of doing this: One, (command "_.insert" "30AL" "s" "1" "r" "0" pause)) This is inserting the block at the scale it was made, and with no rotation option. Two, (command "_.insert" "30AL" "s" "1" pause pause)) This is inserting the block at the scale it was made, and with a rotation option. If it was up to me, and your block was made 1:1. I would replace the "1" with (getvar "dimscale"), so it scales the block to your dimscale. If it's not 1:1 and you still want to do it this way we can amek it scale the block to 1:1 then scale it back up by the dimscale if you like. If you have anymore questions feel free to ask. Worked perfect...Thanks. Quote
neekcotrack Posted September 26, 2008 Posted September 26, 2008 Worked perfect...Thanks. Welcome if you have any other questions about diesel macro I can help. I use it on a lot of things. You can also have a block insert and put it at any angle with attribute text and make the text always be at 0. It's a very nice thing for fire alarms. Quote
SwervinCL Posted September 26, 2008 Author Posted September 26, 2008 I just had my wife drop off my laptop to me at work so I could see what my old routine looks like. This is how my old routine looked and it worked the same way and I just tried it with what I am doing now, and it works. So if anyone wants an alternative. (defun C:Name () (command "insert" "Block" pause "" "" "") ) Quote
neekcotrack Posted September 26, 2008 Posted September 26, 2008 I just had my wife drop off my laptop to me at work so I could see what my old routine looks like. This is how my old routine looked and it worked the same way and I just tried it with what I am doing now, and it works. So if anyone wants an alternative. (defun C:Name () (command "insert" "block" pause "" "" "") ) Just to be safe I would make the "insert" to "_.insert" so it will work for everyone. Note: This will only work for people that want to insert there blocks at a scale of 1. 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.