Jump to content

Recommended Posts

Posted

I have a lsp that works inserting blocks in the drawing.

To 'load' this blocks, I use to click and drag the .dwg file into the current drawing. By doing this I can import the blocks and layers too.

Is there a way to 'load' these blocks and layers using lisp?

2i4nK

Maybe a lisp to insert this .dwg in the current drawing?

Posted

Use the insert command with the full path of the drawing and you 'd have them all within the current drawing .

 

(command "_.-insert" "the full path of drawing" pause nil)

Posted

Thank you guys, GP_ and Tharwat! :D

 

 

 

 

and Lee too, of course haha

Posted

Sans lisp codes, Explore the power of Design Center[Ctrl+2] and Tool Palettes [Ctrl 3]

Posted
Sans lisp codes, Explore the power of Design Center[Ctrl+2] and Tool Palettes [Ctrl 3]

 

But with Tool Palette I can add one by one only, right?

Posted
But with Tool Palette I can add one by one only, right?

 

While Design center is active, select your block library [folder[] right click and Create Tool Palette of blocks or even on a single file AND even on an open drawing. Try it and see if that works for you.

Posted
While Design center is active, select your block library [folder[] right click and Create Tool Palette of blocks or even on a single file AND even on an open drawing. Try it and see if that works for you.

 

I get the full Palette but it doesn't load the blocks in the new drawing... :/

Posted
I get the full Palette but it doesn't load the blocks in the new drawing... :/

 

 

Of course not. The block tool palettes are there so you can have easy access to the blocks, its not physically on the drawing session but a link [pick at the ready]. It eliminates browsing for folder when using "insert".

 

Perhaps you are referring to Templates.

Options

File

Template setting

Default template File name ofr QNEW

 

Starting a new drawing with tons of Blocks all over the place doesn't appeal to me. Layers/Line-types/MleaderStyles on template is ok. I would suggest you play around with tool palettes and you will see its not just limited to Blocks. You'll be surprise how powerful that tool is.

 

HTH

Posted
Of course not. The block tool palettes are there so you can have easy access to the blocks, its not physically on the drawing session but a link [pick at the ready]. It eliminates browsing for folder when using "insert".

 

Perhaps you are referring to Templates.

Options

File

Template setting

Default template File name ofr QNEW

 

Starting a new drawing with tons of Blocks all over the place doesn't appeal to me. Layers/Line-types/MleaderStyles on template is ok. I would suggest you play around with tool palettes and you will see its not just limited to Blocks. You'll be surprise how powerful that tool is.

 

HTH

haha, it's because I use almost all of these tons of blocks in the drawing.

I made a lisp that helps to insert blocks (position, rotation and stuff) but if someone run the lisp without the blocks loaded properly it gets an error.

So it's needed to 'load' all the blocks first.

I don't think template can help me in this case, I gonna check this on Monday.

Thank you :D

Posted
I made a lisp that helps to insert blocks (position, rotation and stuff) but if someone run the lisp without the blocks loaded properly it gets an error. So it's needed to 'load' all the blocks first.

 

If you ensure the necessary blocks reside in an AutoCAD Support Path (perhaps in a network support path common to all users), your program will be able to locate and insert the blocks when required (depending on how your program is written).

Posted
If you ensure the necessary blocks reside in an AutoCAD Support Path (perhaps in a network support path common to all users), your program will be able to locate and insert the blocks when required (depending on how your program is written).

 

How to do that, hmmmmmmmmm

It seems to be a nice solution :D

Posted
How to do that, hmmmmmmmmm

It seems to be a nice solution :D

 

How is your program creating the block references - INSERT command / entmake[x] / vla-insertblock?

Are the blocks in an AutoCAD Support Path?

Posted
How is your program creating the block references - INSERT command / entmake[x] / vla-insertblock?

Are the blocks in an AutoCAD Support Path?

 

Yes, the blocks are in an AutoCAD Support Path. But they are all in one big dwg :o

It's just

(command "_insert" "blockname" pt1 "" ang)
Posted
Yes, the blocks are in an AutoCAD Support Path. But they are all in one big dwg

 

Run this in your 'big dwg' to export each block to a separate file:

(defun c:blk2dwg ( / def dir dwg )
   (setq dir (getvar 'dwgprefix))
   (while (setq def (tblnext "BLOCK" (null def)))
       (if (zerop (logand 125 (cdr (assoc 70 def))))
           (if (not (findfile (setq dwg (strcat dir (cdr (assoc 2 def)) ".dwg"))))
               (command "_.-wblock" dwg "=")
           )
       )
   )
   (princ)
)

Posted
Run this in your 'big dwg' to export each block to a separate file:

(defun c:blk2dwg ( / def dir dwg )
   (setq dir (getvar 'dwgprefix))
   (while (setq def (tblnext "BLOCK" (null def)))
       (if (zerop (logand 125 (cdr (assoc 70 def))))
           (if (not (findfile (setq dwg (strcat dir (cdr (assoc 2 def)) ".dwg"))))
               (command "_.-wblock" dwg "=")
           )
       )
   )
   (princ)
)

 

wtf :o

You're awesome! :D

Thank you, Lee

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...