sakinen Posted January 16, 2011 Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted January 16, 2011 Share 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 Link to comment Share on other sites More sharing options...
sakinen Posted January 16, 2011 Author Share Posted January 16, 2011 Sorry, my question was a little bit clumsy. I need to Get the Drawing filename. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 16, 2011 Share Posted January 16, 2011 Two ways: (vla-get-Name (vla-get-ActiveDocument (vlax-get-acad-object) ) ) (getvar 'DWGNAME) Quote Link to comment Share on other sites More sharing options...
David Bethel Posted January 17, 2011 Share Posted January 17, 2011 That should lead to an error: 'BLOCK is self referencing' -David Quote Link to comment Share on other sites More sharing options...
pBe Posted January 17, 2011 Share Posted January 17, 2011 Will this have the same effect? (command "-wblock" (vla-get-fullname (vla-get-activedocument (vlax-get-acad-object))) "Y" "") Quote Link to comment Share on other sites More sharing options...
MSasu Posted January 17, 2011 Share 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 Link to comment Share on other sites More sharing options...
David Bethel Posted January 17, 2011 Share 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 Link to comment Share on other sites More sharing options...
danellis Posted January 17, 2011 Share 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 Link to comment Share on other sites More sharing options...
David Bethel Posted January 17, 2011 Share 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 Link to comment Share on other sites More sharing options...
sakinen Posted January 17, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted January 17, 2011 Share 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 Link to comment Share on other sites More sharing options...
sakinen Posted January 18, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
sakinen Posted January 18, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
Lee Mac Posted January 18, 2011 Share Posted January 18, 2011 (vl-filename-base (getvar 'DWGNAME)) [ Ensure (vl-load-com) is called at some point before ] Quote Link to comment Share on other sites More sharing options...
sakinen Posted January 18, 2011 Author Share Posted January 18, 2011 Thanks guys this was very usefull. 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.