AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Insert/Edit Component dialog box customization

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
AdrianSaf
989 Views, 6 Replies

Insert/Edit Component dialog box customization

Hello,

 

I'm using AutoCAD Electrical 2014 and have a few questions related to customizing the insert/edit dialog box:

 

1. Is there a way to modify the existing dialog - both UI and actual functionality? (say for example add a new button that when clicked will call a lisp function or a command)

2. Are there any event one could listen to for the dialog besides the lookup button for catalog? (say for example before show dialog or onclose dialog)

3. Is there a way to fully replace the dialog with a custom dialog ? (similar with what can be done for the catalog lookup dialog)

 

Thank you.

6 REPLIES 6
Message 2 of 7
PatMurnen_Adsk
in reply to: AdrianSaf

AdrianSaf,

 

There is not a way to modify the functionality of the dialog (beyond the catalog lookup). I also can't think of a way to interrupt the dialog popping up when you insert a component. You could replace the Edit Component function with your own to edit the attribute values on the blocks since AutoCAD Electrical is drawing-based, meaning the intelligence is held on the blocks\attributes. However, if you replace the dialog you would lose the functionality that updates related components with the edited values so you would need to duplicate that functionality as well.

 

Maybe if you explain what you want to do that the supplied dialog doesn't do, maybe I can offer some ideas.

 

Regards,

Pat Murnen



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

Message 3 of 7
AdrianSaf
in reply to: PatMurnen_Adsk

Hello Pat,

 

Thank you for your answer.

Here are a few examples of what if would like to accomplish:

1. After the user selects a part from the part catalog and control is returned to the Insert/Edit catalog I would like to auto-generate the TAG based on selected part attributes

2. Using the default autocad catalog database, if I have a custom filed defined in the catalog db for a table I would like to set the value for that custom field as XData or XRecord (ex.: for DS table I add a column "TestDataCol", when I go to the parts catalog selection I can see the new column and values for each row; I then select a part but the data from column "TestDataCol" is not set on the drawing - I would like to have it on the drawing if possible - as an XRecord or part of XData)

 

I've looked at the .dcl files that define the dialogs and seen that they can be modified, I assume I could also modify and event associated with a button (to let's say update the TAG after it does what it originally did) - I'm a .net programmer so I'm not sure this holds true for LISP.

Also I'm kind of weary of modifying the .dcl files since the changes would probably be lost on updates/ patches.

 

Again, thank you.

Message 4 of 7
AdrianSaf
in reply to: AdrianSaf

Another example of something I would like to do:

After inserting a component (selecting the symbol, the location, selecting the part from the catalog and clicking save) I would like to update that component programmatically(say set some XData on it) - I would like do this on a save (save_complete) event for the insert/edit form (that would maibe tell me (thru a parameter) if it was and edit or an insert).

Is there a way I could do something similar with the current API?

Message 5 of 7
PatMurnen_Adsk
in reply to: AdrianSaf

Modifying the .dcl files won't change the program or what it is expecting to find on those dialogs or the actions it performs when a control is used. This is all internal to AutoCAD Electrical.

 

Regarding generating a TAG, AutoCAD Electrical is pretty flexible with its TAG formatting supporting many standards around the world. But, formatting the TAG based on the catalog part is not supported. However, while you have control with the wd_xcat functionality you can format the TAG and pass it back, write it directly to the block, basically whatever you want to do. You have control so your "catalog "lookup" can do whatever it wants. You want to make sure you have the right attribute name for the TAG, schematic=TAG1, panel=P_TAG1.

 

For your second question - the AutoCAD Electrical catalog lookup does not save these custom columns on the component. Actually, only a few of the columns data are saved on the component such as MFG, CAT, ASSYCODE, pinlist information, weblink, and TEXTVALUE. You could use the TEXTVALUE column to assign these custom values if there are attributes on the block. You can add any attributes to the library symbols as needed. The TEXTVALUE data is not saved as xdata, it must have an attribute. You can assign any number of values in here by using this format -

 

<attribute tag name1>=<text value>;<attribute tag name2>=<text value>

 

However, if you are bypassing the standard catalog lookup you can write these back to the block either in your own "catalog lookup" or by passing the xdata name and value back. Remembering that the values are written to the component but can be lost when OK out of the Insert\Edit dialog. (other thread).

 

As far as performing some action like adding xdata after the dialog dismisses, I don't think there is some event, return, or parameter to watch for. You could try wrapping your function around the AutoCAD Electrical Insert or Edit commands or APIs . What I mean by this would be something like -

 

Your Insert command does this -

 

1. find last entity on drawing

2. call AECOMPONENT

3. find last block on drawing and if different than what found in step #1 you know what was inserted, write any xdata on to it

 

or if you didn't want to use the icon menu you can do the same thing using the API c:wd_insym2 command which returns the entity inserted. Or any of the number of Insert APIs supplied.

 

For editing you could use the API c:wd_edsym2 which returns a bunch of info including the entity edited.

 

Regards,
Pat Murnen



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

Message 6 of 7
AdrianSaf
in reply to: PatMurnen_Adsk

Hello Pat,

 

Again, thank you for the answers - especially for treating both cases of using the default catalog functionality and the custom catalog path. I have not decided on one yet.

 

I understand what you are talking about when you say wrap around the current Electrical functionality, and agree that it would work great if I wanted to implement it as a separate command.

 

The problem is that I would like to append this functionality to the current functionality directly (by that I mean the user would not run a custom command, he would just go and add a component normally - go to the menu and click insert component).

 

From what I've seen I don't think i will be able to do this without creating my own custom command (if i can please let me know). Is there a way to "override" a command? (say when the user runs AECOMPONENT - from both ribbon and command - make it so that my command would run instead)

If not I assume I can go with a separate command.

 

Thank you.

Message 7 of 7
PatMurnen_Adsk
in reply to: AdrianSaf

I didn't try this but I am pretty sure you can override a command by simply naming your command the same and making sure yours loads last. Not sure I would recommend this but I think it would work. Of course you can change the ribbon or menu to just use your command instead of say AECOMPONENT. This would take care of everything except the command line. Which could be a good thing if you ever wanted just the AutoCAD Electrical functionality.

 

Regards,

Pat



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report

”Boost