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: 

Programmatically creating AutoCAD Electrical symbols

8 REPLIES 8
Reply
Message 1 of 9
TXACDE24
329 Views, 8 Replies

Programmatically creating AutoCAD Electrical symbols

Hi,

What else do we need to do other than creating the needed Attribute References for the required attributes and wire connections for a custom symbol created by code?

TXACDE24_1-1717948367347.png

I have a symbol with all four wire connection related attributes (TERM.. and X.TERM..), but it does not auto connect to wires when using it.

TXACDE24_0-1717948189352.png

Thanks,

 

 

 

8 REPLIES 8
Message 2 of 9
Ed.Jobe
in reply to: TXACDE24

Before learning how to do this programmatically, you need to learn how to do it manually. I will move this to the acade forum for you to find out how.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 3 of 9
rhesusminus
in reply to: TXACDE24

There's a naming convention for the blocks also:
https://help.autodesk.com/view/ACAD_E/2023/ENU/?guid=GUID-426D2FCD-D82A-4FB7-A657-28D8B2EC336D


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 4 of 9
TXACDE24
in reply to: Ed.Jobe

I do know how to create AutoCAD Electrical symbols manually and how to create AutoCAD blocks programmatically.

The question is what specific attribute definitions or attribute references we need to add to the AutoCAD blocks in the program to make the block work as AutoCAD Electrical symbols.

E.g. the attributes I highlighted in the starting post.

Message 5 of 9
pendean
in reply to: TXACDE24


@TXACDE24 wrote:

I do know how to create AutoCAD Electrical symbols manually and how to create AutoCAD blocks programmatically.

The question is what specific attribute definitions or attribute references we need to add to the AutoCAD blocks in the program to make the block work as AutoCAD Electrical symbols.

E.g. the attributes I highlighted in the starting post.


Like what please? your posts to date are not specific, too generic.

A sample DWG with one or more of your blocks in it with an explanation inside that file how you wish to use it in detail might help others help you 'specifically'.

 

TIA

Message 6 of 9
rhesusminus
in reply to: TXACDE24

The help files happens to mention what attributes that are needed, and what they're supposed to be named also:

AutoCAD Electrical 2023 Help | About Schematic Attributes | Autodesk


Trond Hasse Lie
AutoCAD Electrical and EPLAN expert
Ctrl Alt El
Please select "Accept Solution" if this post answers your question. 'Likes' won't hurt either. 😉
Message 7 of 9
rbh2024
in reply to: rhesusminus

Thank you for this link to the help file I have been looking for this as well!!!

Message 8 of 9
TXACDE24
in reply to: pendean

Like the Wire Connection attributes (TERM01 and TERM02). I created TERM01/TERM02 and X4TERM01/X1TERM02 block references, but they still are regular attributes instead of real "Wire Connections" when placed in AutoCAD Electrical drawings.

TXACDE24_0-1720338089421.png

 

 

Message 9 of 9
arshdeepsingh404
in reply to: TXACDE24

Hi @TXACDE24 

 

I wrote a similar program a while ago that does symbol building but much faster than the symbol builder. One click place all required attributes at auto calculated positions.

https://www.linkedin.com/posts/arshdeep-singh-c-tech_autocad-autolisp-autocadelectrical-activity-720...

 

I used the standard entmake to create all the attributes and as long as the symbol is saved using the correct naming convention, the symbol works like any other ACE symbol.

 

    (entmake                                                                  ; Create a new entity in the drawing 
      (list 
        (cons 0 "ATTDEF")                                                     ; Entity type:                Attribute Definition
        (cons 1 AttributeDefaultValue)                                        ; Default value:              EmTopManualPTY String
        (cons 2 (nth index AttributesList))                                   ; Tag string:                 From List
        (cons 3 "")                                                           ; Prompt string:              EmTopManualPTY String
        (cons 8 "0")                                                          ; Layer name:                 Layer 0
        (cons 10 '(0.0 0.0 0.0))                                              ; Insertion point:            0,0,0
        (cons 11 (list xCoord yCoord zCoord))                                 ; Insertion point:            User Specified
        (cons 70 AttributeVisibility)                                         ; Attribute flags:            0 (Visible) 1 (Invisible)
        (cons 72 1)                                                           ; Horizontal Justification:   1 (Center)
        (cons 74 0)                                                           ; Vertical Justification:     0 (Not Specified)
        (cons 40 (atof AttributesHeight))                                     ; Text height:                User Specified
      )
    )
    
    (terpri)                                                                  ; Command Line Carriage Return
    (princ (strcat "Attribute Inserted: " (nth index AttributesList)))        ; Print Attribute Inserted: Name to Command Line
    (terpri) 

 

 

With regards to making the wire connections manually, You seems to be doing it correctly.

I inserted the attributes in a regular drawing with standard ATTDEF command and and created a BLOCK (without symbol builder as you would do with a program) and AutoCAD seems to recognize it no problem.

 

arshdeepsingh404_0-1720408071433.png

arshdeepsingh404_1-1720408079442.png

 

One of the most common problem that many users runs into is that forget to purge the drawing before trying out a new instance of the same Block. Make sure you are purging the block or trying it on an fresh new drawing.

 

Second thing to verify would be the Symbol naming convention.

https://help.autodesk.com/view/ACAD_E/2022/ENU/?guid=GUID-426D2FCD-D82A-4FB7-A657-28D8B2EC336D

 

And the last thing is to be mindful about the XTERM attributes which is where the wire connections are made (the green x shown while running wire command). Make sure everything is on layer "0" as well.


For Left Connections: TERMxx and X4TERMxx attribute

For Right Connections: TERMxx and X1TERMxx attribute

For Top Connections: TERMxx and X2TERMxx attribute

For Bottom Connections: TERMxx and X8TERMxx attribute

 

 

 

Regards,

Arshdeep Singh, C.Tech, CMSE®
Electrical Designer & Programmer
LinkedIn

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report