Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

custom CUI help for blocks please

11 REPLIES 11
Reply
Message 1 of 12
tony
3243 Views, 11 Replies

custom CUI help for blocks please

I was on an older cad and am now moving to 2014.. my previous cad was heavily customized the old school way, I have decided to learn the CUI (and dynamic blocks)

 

Ok, My old cad has blocks on a drop down menu.. click BATH menu than WC icon, a macro sets the correct layer than inserts the WC.. took time to setup but pretty simple and straight forward (see attached for menu syntax). I also made a toolbar BATH and on that toolbar I made a WC icon.. that’s what I use the most

 

couple of questions

 

1) do I have to make a new command in CUI for each block to do the same thing?

 

2) I looked into the design center, but seems like its too many steps (correct me if im wrong please).. but it seems a toolbar with an icon on it, clicking the icon and a macro sets layer and insers block is still pretty quick..??

 

3) if a toolbar with an icon is still a fast and less step method, can I open the block and somehow make an icon of it? if so where do I put it?

 

Like I said im old school but recognize its time to play catch up and learn the new methods.

 

I appreciate the responses!

11 REPLIES 11
Message 2 of 12
gccdaemon
in reply to: tony

You'd probably be better creating a tool palette. It's similar to the Design center only it stores additional information (laters, colors, etc) and references the block definition from a "Source DWG". I've attached a screen shot of what I made as well as a screen shot of the properties for one of the blocks. I created a file with all my blocks in it to pull the definitions from. All you have to do is

 

1. create a block in the drawing

2. save the drawing

3. then drag the block into the tool palette

 

The block images can be updated by right clicking on them and selecting "update tool image". You can also open the block for edit in the source drawing block editor, as well as update the block definition in the current file. Hope this helps some, because there are more helpful tools available through the tool palette.

Andrew Ingram
Civil 3D x64 2019
Win 10 x64 Pro
Intel Xeon E5-1620
32 GB Ram
Message 3 of 12
dgorsman
in reply to: tony

In general, every single tool you want in your user interface (UI) will require a separate command definition in the CUIx.  This definition acts like an XREF drawing - one definition referenced in many places (Ribbon, toolbar, menu) allows changes (e.g. command macro) to be made in one place.

 

More specifically, your previous arrangement (one command tool per block) may not work as well with the new UI systems.  The user is presented with a huge number of items, or has to dig down several levels.  That can be OK for very common blocks, but its easy to end up with toolbars and buttons cluttering the screen when they rarely get used.  Folding ribbon panels and drop-downs can eliminate some of that.  But it may be better to consolidate some of the lesser-used items into custom insert routines which, when clicked, provide the user with a selection of items.

 

Tool palettes can also be useful, but managing palette groups etc. from a central location can be a little frustrating.

 

Creating icons is a real PITA for those who aren't graphic artists by nature (ie. ME).  Consolidating blocks into a single command will reduce the number of icons you need to create.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 4 of 12
bhull1985
in reply to: dgorsman

Totally a reasonable approach, the one dgorsman suggests.

There are of course alternatives.

My method is one driven by CUI and lisp+dcl combos, and one toolbar for very useful 7 tools.

Yes the buttons/icons were a PITA...

 

 

Lone toolbar, created some icons borrowed others from autocad library 🙂

menu4.jpg

 

Example of how a dropdown utilitizing DCL appears

menu3.jpg

 

Typical drop-down menu called DCL driven example, each of these items when clicked on will insert the fitting and if onto blank space will pause for rotation, always keeping a 1 and 1 scale, but if onto a line the program will insert, then trim the underlying line out be it a lwpolyline or otherwise. The images are slides made with mslide. 

menu2.jpg

 

Only dropdown functionality. Dual method for selection, users felt this was better than only the dialogs for this catagorey. These will all insert the same as the DCL driven items, i.e. they will trim if the insertion point is on a line the lengths i have designated in the code.

menu1.jpg

 

Credits and kudos to many including lee mac and kentcooper for assisting in creating this first real program for me

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 5 of 12
Lee_Mac
in reply to: bhull1985

Looks good Brandon - well done! Smiley Happy

Message 6 of 12
hmsilva
in reply to: Lee_Mac


@Lee_Mac wrote:

Looks good Brandon - well done! Smiley Happy


1+

 

Nice program Brandon.

 

Henrique

EESignature

Message 7 of 12
bhull1985
in reply to: tony

Couldn't have done it without the continued assistance of the two fellows posting above.

Thanks again you guys, I can't express how great of a feeling it is to bring something more to the table.

And honestly I did not post that to miff the OP, the source code is available upon request. (pm preferably)

Obviously OP would need to re-code everything to their fittings (block name and trim distances), and then take mslides of their entire library.

And those are just the first steps....but, it's a workable option and the leads that have been in the business 25+ years having to manually do *everything* such as Set layer--->Insert-->Block-->Browse to block-->setup insert dialog for block-->place block onto a line---> trim line, whereas now you can imagine two clicks being alot quicker, more effecient, the leads are happy, and there are side benefits such as continued use of this program ridding our new multiple hundred p&id job of the little variances that show when different persons draft similar documents, also the human error that occurs due to layer standards and snap settings- all taken care of and requires the user to simply select from the drop down which menu to load, and then select their fitting and it's insertionpoint.

 

Again thanks to so many gurus in the completion of this program, i had no idea about a conditional when I started this program. In fact, the (cond) statement still running the routine is the exact same that was laid out by kent cooper nearly 6 months ago for me! Hah, how the time has passed.

 

Henrique- thanks for helping with the insertionpoint code, that was far too advanced for me then and it's only now that I finally am understanding what you've coded. As such, i'll disect it, right here and now. Don't you remember this beauty?

(if (setq insertpt1 (getpoint "\nPick Insertion Point: "))               ;set variable insertpt1 to user get point
(progn                                                                   ;if point selected do the following
  (if (and (setq ntsel (nentselp insertpt1))                             ;if+and assign variable ntsel to the values returned by nentselp, 
                                                                         ;nil if in space, returns name/insertpt if on a line
	   (= (length ntsel) 2)                                         ;if on a line and the length of items returned is 2
	   (setq name (car ntsel))                                      ;set a var to the first item in the previous list, entname
	   (wcmatch (cdr (assoc 0 (entget name))) "LINE,LWPOLYLINE")    ;wcmatch the entity type to line/lwpolyline 
	   );; and
    (setq objx 1)                                                        ;if both the conditions are true raise the objx flag
    );; if

 That's definitely one of the more complicated sections of code and was brought about due to considering user input that did not follow the prompts that were given at that time. It was tough to determine where the user would place the fitting if it was either in space or on a line, and as thus henrique you and I emailed back and forth for a day to arrive at this solution. Granted, you were doing most of the coding, I was testing!

 

Fun times regardless and it did not go to waste!

 

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Please use code tags and credit where credit is due. Accept as solution, if solved. Let's keep it trim people!
Message 8 of 12
hmsilva
in reply to: bhull1985

Writing, testing, correcting, testing, rewriting, testing, correcting, testing...

 

It's the programmer life... Smiley Happy

Henrique

EESignature

Message 9 of 12
tony
in reply to: tony

I appreciate all the responses!

for tool palettes, i currently have a block directory.. do i open each drawing and add each one to the tool palette? and when i want to modify the block do i open that block dwg in my block directory and modify and it updates the tool palette? also, if i am in a drawing and make a new block and add it to the tool palette does it ask me where to save the block?

on the CUI, i added my .MNS file to cui and it actually added the menus and toolbars, of course the icons where clouded out, i assume i have to copy the icons i made to an icon directory in the file path, but the commands were all there and they worked, blocks worked also.. what are the "Cons" of doing it this way in the new cad world?

im going to play around with it today and may be able to answer my own questions.. but its good to see how others look at it, i want to see the advantage of tool palettes over one click blocks on a toolbar..

 thanks again!

Message 10 of 12
Lee_Mac
in reply to: tony


@Tony wrote:

for tool palettes, i currently have a block directory.. do i open each drawing and add each one to the tool palette?


Personally, I find it easier to drag blocks from the Design Center when populating tool palettes.

Message 11 of 12
tony
in reply to: Lee_Mac

Thanks Lee

ok, i think im going with the tool palette..

i have a block library/directory of blocks, when i open the drawing (block) its not a block, its separate entities (becomes block when i insert).. do i have to open each drawing, make it a block (assume make it same name as the drawing) than drag the block to a new tool pallete that i make?.. do that for each block?

thats a lot of work, but i guess its necessary unless someone shows me a method im missing.

thanks everyone!
Message 12 of 12
Lee_Mac
in reply to: tony


@Tony wrote:

i have a block library/directory of blocks, when i open the drawing (block) its not a block, its separate entities (becomes block when i insert).. do i have to open each drawing, make it a block (assume make it same name as the drawing) than drag the block to a new tool pallete that i make?.. do that for each block?

Oh definitely not! - That would be an immense amount of work!

 

No, simply locate the drawing in Design Center and drag the drawing file onto a Tool Palette - you can even drag a drawing file directly from Windows Explorer if this is easier.

 

Lee

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost