Inserting blocks with LISP commands into Tool Palettes

Inserting blocks with LISP commands into Tool Palettes

Anonymous
Not applicable
1,266 Views
5 Replies
Message 1 of 6

Inserting blocks with LISP commands into Tool Palettes

Anonymous
Not applicable

Hello everyone,

 

Can someone help me with a lisp that asks for insertion point and selection to select a block,

and then insert it without deletion of the original into a tool palette to a new tab called "my block",

* If I select a group of entities it will convert them to a block and enter them into the same tab called " my block".

* If I select a block or dynamic block it will enter it as is into the same tab.

 

Thanks for all the helpers,

Eyal.

0 Likes
1,267 Views
5 Replies
Replies (5)
Message 2 of 6

rapidcad
Collaborator
Collaborator

Hi Eyal. I believe that what you are attempting to do is not accessible to Vlisp. It may be possible in .Net or another programming language but I don't know how to build any tool palette tool on the fly. The tool palettes are written in XML if you want to investigate, download the free XMLNotepad program and give that a try. Your best bet would be to write a lisp program to do the blocking of the entities and write the block to a folder of your choice. Then you could use Windows Explorer or DesignCenter and just drag the DWG into an empty tool palette and an insertion tool will automatically be created.

 

HTH

ADN CAD Developer/Operator
0 Likes
Message 3 of 6

Anonymous
Not applicable

Hi,

I don't think you understand exactly what I wanted,

I want by selecting a group of entities or blocks ,it will insert them into the Autocad build-in tool pallete, but into the same tab.

By insert the first block it will create a tab , entitled "My blocks" , and then every block or group that I will insert by operating the lisp it will go to the same tab that I created.

 

I hope I clear now.

Thank you.

Eyal 

0 Likes
Message 4 of 6

rapidcad
Collaborator
Collaborator

Hi. Here is a lisp program that I adapted (a while ago) to wblock blocks in the current drawing to a folder of your choice. It could be adapted to build in the block command to select objects other than already created blocks as well, but that will require some sub commands to activate (maybe entering a hotkey like M to make a block?) That would present a few problems like how to get back to wblocking already made blocks, error trapping, and settings that may be required. I really don’t have time today to look at this though.

 

After the files are in the folder the last step cannot be automated as far as I know. You must use windows explorer or AutoCAD Design Center to drag the folder containing your blocks into a blank tool palette. I do not believe that lisp can use AutoCAD Design Center to automatically drag a folder containing blocks into the tool palette. You would have to do this yourself manually.

 

That step of dragging the folders into the tool palette is not the same thing as just putting the blocks in a folder (which is what this lisp or the WBLOCK command does). When a user drags a block or folder into a blank tool palette (or even a full tool palette for just one block) AutoCAD writes an editable block tool using XML (not lisp) to insert the block whenever a user picks the tool. To automate this is not possible since this is not exposed to the programming interface as far as I know.

 

If this helps I always appreciate kudos or "Accept as solution" responses.

ADN CAD Developer/Operator
0 Likes
Message 5 of 6

rapidcad
Collaborator
Collaborator

Forget the last program - I didn't take out all of the filtering I was doing with the custom version I had altered for our use. It looks like it filters out all blocks unless they conform to our strict naming convention. Try this version. It will Wblock any block no matter what the name is.

 

If this helps I always appreciate kudos or "Accept as solution" responses.

ADN CAD Developer/Operator
0 Likes
Message 6 of 6

Anonymous
Not applicable

Hi @rapidcad,

It is not working, and not as I wanted.

I wanted a lisp that let the user to select objects and enters them into the Tool palette in a tab called " my blocks",

and every time I use the lisp in this drawing it will enters the selected object into the same folder I created in the tool palette.

 

Regards,

Eyal

 

 

0 Likes