sakinen Posted January 16, 2011 Posted January 16, 2011 Im building a lisp that is going to automaticaly make a block with the same name as the file thats in. With what function i can do that? Quote
Lee Mac Posted January 16, 2011 Posted January 16, 2011 With what function i can do that? Do what? Make the block? Get the Drawing filename? What part do you need help with? Quote
sakinen Posted January 16, 2011 Author Posted January 16, 2011 Sorry, my question was a little bit clumsy. I need to Get the Drawing filename. Quote
Lee Mac Posted January 16, 2011 Posted January 16, 2011 Two ways: (vla-get-Name (vla-get-ActiveDocument (vlax-get-acad-object) ) ) (getvar 'DWGNAME) Quote
David Bethel Posted January 17, 2011 Posted January 17, 2011 That should lead to an error: 'BLOCK is self referencing' -David Quote
pBe Posted January 17, 2011 Posted January 17, 2011 Will this have the same effect? (command "-wblock" (vla-get-fullname (vla-get-activedocument (vlax-get-acad-object))) "Y" "") Quote
MSasu Posted January 17, 2011 Posted January 17, 2011 That should lead to an error: 'BLOCK is self referencing' -David I’m afraid that there is no restriction for having a block with the same name as the drawing that contains it - just tested in 2008 and 2010. Regards, Mircea Quote
David Bethel Posted January 17, 2011 Posted January 17, 2011 Make a drawing with a block with the same name defined. Try inserting that dwg file into a new dwg file. You should get an error/ warning. -David Quote
danellis Posted January 17, 2011 Posted January 17, 2011 While this is true, not everybody inserts blocks in this way. Perhaps if Sakinen could say what exactly he's trying to achieve (i.e. why he needs the block's name to match the drawing) we may be able to help some more. dJE Quote
David Bethel Posted January 17, 2011 Posted January 17, 2011 In 2000 it errors out Command: -insert Enter block name or [?]: testb Block testb references itself *Invalid* So in general, it is a bad practice, in real world scenarios, it is an unacceptable format. -David testb.dwg Quote
sakinen Posted January 17, 2011 Author Posted January 17, 2011 While this is true, not everybody inserts blocks in this way. Perhaps if Sakinen could say what exactly he's trying to achieve (i.e. why he needs the block's name to match the drawing) we may be able to help some more. dJE I need to prepare blocks for autocad MEP mvparts. The name of the drawing is the name of the future dimension of the part in the mvparts so its easy to add them when the names of the blocks and the names of the drawings are the same. I have alot of those and i need to make it automatic. Quote
Lee Mac Posted January 17, 2011 Posted January 17, 2011 I need to prepare blocks for autocad MEP mvparts. The name of the drawing is the name of the future dimension of the part in the mvparts so its easy to add them when the names of the blocks and the names of the drawings are the same. I have alot of those and i need to make it automatic. But the drawing is the block - I'm with David on this one. Quote
sakinen Posted January 18, 2011 Author Posted January 18, 2011 While this is true, not everybody inserts blocks in this way. Perhaps if Sakinen could say what exactly he's trying to achieve (i.e. why he needs the block's name to match the drawing) we may be able to help some more. dJE Ill better tell the whole story. What i wanted in this thread is part of the problem. I want to make MVparts for autocad MEP. I have lets say 50 drawings of 50 3d circulating pumps. I need to make mvpart with 50 "sizes". I need to open the file, then make a block of 3d model and name it like the file because the file is named after the pump "size" (type). When im making MVPARTS and ad sizes its easy when a block is named after a pump type. Of course when i do this in all of the drawings i need those blocks in one drawing so i can pull them in MVPART. I have about 300 pump sizes so you can imagine what a taunting and time consuming job this is. Quote
sakinen Posted January 18, 2011 Author Posted January 18, 2011 (defun c:BMK () (command "-block" (getvar 'DWGNAME) "0,0,0" "all" "") ) This is what i came up with your help. The problem is that it names the block xxxx.dwg. I dont need an extension in block name. Quote
Lee Mac Posted January 18, 2011 Posted January 18, 2011 (vl-filename-base (getvar 'DWGNAME)) [ Ensure (vl-load-com) is called at some point before ] Quote
sakinen Posted January 18, 2011 Author Posted January 18, 2011 Thanks guys this was very usefull. 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.