AECOMPONENT via C# with no user input

AECOMPONENT via C# with no user input

mcoH3VZV
Advocate Advocate
586 Views
1 Reply
Message 1 of 2

AECOMPONENT via C# with no user input

mcoH3VZV
Advocate
Advocate

Hi,

 

I am using AutoCAD Electrical 2018 and am trying to use the AECOMPONENT Command and insert a component without opening the Icon Menu dialog box using C#. I know of the sendstringtoexecute command, but it seems as though only the "-INSERT" command works with this. The problem with INSERT is that it does not break the wire upon insert.

 

Is there any way to use AECOMPONENT without any user interaction and have it break the wire when the component is inserted? Or is there a way to use the INSERT command and immediately break the wire using another command afterwards?

 

Thanks,

0 Likes
Accepted solutions (1)
587 Views
1 Reply
Reply (1)
Message 2 of 2

mcoH3VZV
Advocate
Advocate
Accepted solution

I was able to do this by the following:

 

1. Create a UI or database with insertion points and desired attributes.

2. Open a transaction and use this command: ReadDwgFile(FileName, FileOpenMode.OpenForReadAndAllShare, true, ""), and edit the values necessary for the block.

3.  Find the wire it was inserted on (if any) and delete it.

4. Delete WDDOT on the start point of the wire if it was present.

5. Insert a new wire using c:ace_insert_wire

0 Likes