Jump to content

Use burst command within autolisp.


Mbuk

Recommended Posts

Hi

 

I am making a lisp routine that inserts a block and breaks the line the block is inserted in. The block inserted is a pump schematic which includes the valves, strainer and control points (tags). I use the BREAKDIM attribute (invisible) to set the width of the linebreak that the block is inserted into. (some of you old lispers would remember the code BBlock.lsp )

 

I am would like to burst the block after inserting it from within the lisp routine. If I use the code

 

(C:burst)

 

It invokes the burst command but prompts me to: select objects.

 

I would like to have it burst the block that was just inserted (entlast) or let me input the block name.

 

Another option would be to use the (command "._explode" "L" "") function and then erase the attribute Def -`BREAKDIM. To do this I would need some code to find an Attribute def (not in a block anymore as it was just exploded) with the TAG "BREAKDIM" and then use the `command "erase" function to delete it.

 

If anyone can help it would be much appreciated.

 

Mbuk

Link to comment
Share on other sites

Welcome to CADTutor MBuk! I'm sure you'll like it here :)

 

Firstly, have you seen this? Might do what you want.

 

As you seem to want to erase the invisible attribute, you might want to see this also.

 

Good luck!

 

Lee

Link to comment
Share on other sites

Welcome to CADTutor MBuk! I'm sure you'll like it here :)

 

Firstly, have you seen this? Might do what you want.

 

As you seem to want to erase the invisible attribute, you might want to see this also.

 

Good luck!

 

Lee

 

 

Thanks Lee.

 

I won't get a chance to work on this again until next Saturday. I will try to check in during the week. I definitely want to try your lisp routine. It looks really impressive. Thanks so much. This seems to be a really professional site.

 

You're right about erasing the invisible attribute. The only reason for the exploding is to allow mirroring of the block with out reversing the attribute text.

 

Ive attached the two blocks I want to insert. (Each drawing has multiple blocks within it.) I thought you might want to try inserting them with your routine.

 

Here is the problem. I want to prompt the user only for the a51-59B (P-XX) attribute, the others should be capable of editing after the block has been exploded, but the blocks called BAS-HHA are usually only edited by a few senior people. Also I wanted the user to be able to mirror the pump and valves if required, but only because the attribute text doesn't respond to the `mirrtext' setvar when mirrored, otherwise I could mitrror the whole thing. So I opted to just insert the block unexploded and then let the users use burst and mirror all the objects themselves The reason for the two blocks is that the some of the blocks within these blocks require two colours. If the users want the schematic to be existing the X... block will be inserted ,otherwise the C.. block will be inserted. The colours and line-weights for new and existing are not the same.

 

I know enough to use and modify most of the simple lisp routines we have. The drawings attached are parts of schematic drawings that I will have the user insert from a image tile from the legacy part of the autoCAD menu's. Maybe a more modern way of doing this would be to use dialogue box programming but I'm not that experienced at those and can't seem to find decent books to learn from.

 

I only get an opportunity to work on these when we modify the menu's during AutoCAD version migration. We are presently upgrading from 2009 to 2011, so I am trying to add as much as possible while I have some time - but I have forgotten some of the lisp programming. Your help is much appreciated.

 

I've looked at your website. You are an amazing programmer! Our company has started to use Revit on some projects. Are you able to program in Revit?

 

Thanks again for the reponse,

 

Mark (Mbuk)

C-PUMP-AFD.DWG

XC-PUMP-AFD.DWG

Link to comment
Share on other sites

test_blocks.dwg

 

Thanks Lee,

 

A couple of questions. How would I modify `iburst.lsp' to allow me to input (pass) a block name from within autolisp? I am familiar with autolisp but not with visual lisp. (Iwould like to pass the block name from a toolbar button.) I am inserting these blocks from and image tile menu selected from a menu toolbar button. the command code I'm using to insert the block is:

 

^C^C^P(c:hhasysSCH)(setq H_Blk "A22-26")(BBLOCKSCH 1);\A22-26;(C:NRbblkins-SCH)(princ)

 

hhasysSCH - checks if block is to be inserted on a new or existing layer, and also checks if scale has been set.

 

BBLOCKSCH - is the function that checks if the block (A22-26) has breakdim as it's first entity and breaks the line after insertion by the NRbblkins-SCH function (NR stands for not rotated - SCH is for Schematic. you may recognize the BBLOCK function from 1987)

 

I tried your autobreak block routine. It works well as long as the block bounding box width matches the width you want to trim. (try your routine with the attached block -1a in test_block - 1b also in the dwg is a the same block inserted using breakdim).

 

 

 

I would love to use a modifed version of your autobreak block to insert a block into a double line pipe, and have it break all lines crossing the boundary area of the block. (see 2a and 2b also in test_block drawing.) If it is possible to modify it so it could be passed via a command line similar to above, it would be much appreciated.

 

Your website is amazing. You are a very good programmer.

 

Your help is much appreciated. (I only work on the CAD stuff on weekends -so it may take some time to respond - please bear with me)

 

Thanks,

 

Mark (Mbuk)

Link to comment
Share on other sites

A couple of questions. How would I modify `iburst.lsp' to allow me to input (pass) a block name from within autolisp? I am familiar with autolisp but not with visual lisp. (Iwould like to pass the block name from a toolbar button.)

 

How would the LISP know what block to explode if supplied with just a block name? The function would require an object - without modification you can supply this via an implied SelectionSet, for example, to explode the last entity created:

 

(sssetfirst nil (ssadd (entlast))) (c:iBurst)

I tried your autobreak block routine. It works well as long as the block bounding box width matches the width you want to trim. (try your routine with the attached block -1a in test_block - 1b also in the dwg is a the same block inserted using breakdim).

 

I shan't try your attached block as this is a noted restriction induced by the algorithm the program uses to determine the break points - it is noted in the program description on my site.

 

I would love to use a modifed version of your autobreak block to insert a block into a double line pipe, and have it break all lines crossing the boundary area of the block. (see 2a and 2b also in test_block drawing.) If it is possible to modify it so it could be passed via a command line similar to above, it would be much appreciated.

 

I'm not looking to modify this program at present.

 

Regards,

 

Lee

Link to comment
Share on other sites

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...