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: 

Pass parameters into wd_dinrl command?

13 REPLIES 13
Reply
Message 1 of 14
jnorris3GZ65
541 Views, 13 Replies

Pass parameters into wd_dinrl command?

Is it possible to pass parameters into the wd_dinrl command?  I would like to create a few command shortcuts on my icon menu to open the din rail dialog window with a specific catalog entry already selected.  That way I can pick "insert 2x2 wire way" or "insert din rail" and not have to mess with the dropdown menu each time. 

13 REPLIES 13
Message 2 of 14

Hi @jnorris3GZ65 

 

When running the WD_DINRL (DIN Rail Generator) command, It uses a .xls file. I think the order is displayed as is

in the excel file. I tried moving the duct to first row and it changed in Din Rail dialog box to be the default prompt.

 

File: C:\Users\UserName\Documents\AcadE 2025\AeData\en-us\catalogs\wddinrl.xls

 

arshdeepsingh404_0-1721703987826.png

arshdeepsingh404_1-1721704014619.png

 

However, You want to have few shortcuts linked, which according to me would require modifying the  WD_DINRL lisp file. Now this command file is stored as AutoCAD Fast-load AutoLISP File (.fas) which is a complied version of code and can not be modified.

 

Have you considered using dynamic blocks with catalog data as an alternative?

  • See the attached Din Rail 35mm Dynamic Block (Imperial Scale - Scale it up by x25.4 if using mm units).
  • Modify the CAT and MFG attribute default values to your preference.
  • Save them as new files with different name.
  • Link them to icon menu.

 

arshdeepsingh404_2-1721705157101.pngarshdeepsingh404_3-1721705187537.png

 

Regards,

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

Please mark as "Accept Solution" if this resolved your issue. It might help someone else with the same question. Likes are welcome!
Message 3 of 14

Alternatively, there is an API c:ace_ins_dinrail that may be useful, you will have to create your own command in lisp to use it.

 

jamesmcmillanNYR6A_0-1721725033588.png

 

Message 4 of 14
alds02
in reply to: arshdeepsingh404

Perhaps for DIN rail a dynamic block can't do much harm, but it is known that dynamic blocks are incompatible with AutoCAD Electrical because the "handle" keeps changing.

Message 5 of 14
jnorris3GZ65
in reply to: jnorris3GZ65

I was able to put together a command using the ace_ins_dinrail api call and getpoint/getdist to make something that mimicks a default type of command.

 

It can only insert left to right (if horizontal) or bottom to top (if vertical), which is just a small annoyance.

 

(setq base (getpoint "\n Base Point"))(c:ace_ins_dinrail "AB" "199-DR1" "" (list base (getdist base "\n Distance") "H" 1.0 3))

Message 6 of 14

can you put in a negative distance?

Message 7 of 14

It does not appear so, it seems it is always positive regardless of which direction I go with the cursor. Trying to hardcode in a negative value also seems to still produce a positive length.
Message 8 of 14

Great idea! @james.mcmillanNYR6A

I completely forgot about the APIs, that would work great here.

 

Regards,

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

Please mark as "Accept Solution" if this resolved your issue. It might help someone else with the same question. Likes are welcome!
Message 9 of 14

I actually use the dynamic block method and haven't had problems yet.

 

I've attached my block for reference, not suite as sophisticated as yours @arshdeepsingh404 but I seem to have broken yours!

 

jamesmcmillanNYR6A_0-1722003801892.png

jamesmcmillanNYR6A_2-1722003835701.png

 

 I couldn't see any option for direction of the din rail in the dialogue, which may suggest why it has no option in the API, or does it let you pick direction after insert?

Message 10 of 14

James,

 

I didn't get a chance to download your block and try it out today.  Do you have the ACADE CAT and MFG attributes in it?  Have you run into any issues with it duplicating or ignoring ACADE attributes?

Message 11 of 14

Hi @jnorris3GZ65 

 

Try the attached DinRail.lsp when you get a chance.

I was able to get the direction working with few extra steps.

 

1. Get basepoint

2. Get second point
3. Calculate length

4. Calculate Angle

5. Call c:ace_ins_dinrail API and force to horizontal insertion

7. Get last entity and modify the angle as calculated in step 4


 

However I was facing a problem, the c:ace_ins_dinrail keeps defaulting to last selected catalog option in the insert dinrail GUI even though I am passing it (c:ace_ins_dinrail "AB" "199-DR1" "" params) API.

 

There is another thread with a similar problem which was apparently solved but it didn't worked for my ACE2025 environment.

https://forums.autodesk.com/t5/autocad-electrical-forum/din-rail-api-command-issues/td-p/8123293

 

 

 

Regards,

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

Please mark as "Accept Solution" if this resolved your issue. It might help someone else with the same question. Likes are welcome!
Message 12 of 14

@ arshdeepsingh404

That lisp routine works for me, seems to use the correct din rail each time, even if I use the din rail tool to insert a different catalog entry in-between using the lisp. After reading the thread you linked, I wonder if the issue is something to do with the assembly code like mentioned in that thread. I have modified my din rail excel file and removed most of the entries and replaced them with the products that we use, and none of them include a value in the assembly code.
Message 13 of 14

@jnorris3GZ65 That's great to hear! For me it kept rejecting even after adding assembly codes or modifying the excel file too.

 

Since it worked for you, I have modified and attached the lisp to how I was originally intending to write it by passing Manufacturer and Catalog externally instead of hardcoding it.

 

Try the modified lisp when you get a chance.

Syntax (dinrail "Manufacturer" "Catalog")

Example use (dinrail "AB" "199-DR1")

 

This way you can create all the combinations you want and link them to icon menu with only using one lisp and passing different catalogs.

 

Regards,

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

Please mark as "Accept Solution" if this resolved your issue. It might help someone else with the same question. Likes are welcome!
Message 14 of 14

Hi @james.mcmillanNYR6A 

 

That was my bad, I mistakenly attached the old test version of the dynamic block.

Thanks for pointing it out. I have attached the correct version of the block in case anyone needs it.

 

arshdeepsingh404_0-1722304345828.png

arshdeepsingh404_1-1722304368443.png

 

Regards,

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

Please mark as "Accept Solution" if this resolved your issue. It might help someone else with the same question. Likes are welcome!

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

Post to forums  

Technology Administrators


AutoCAD Beta