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.
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
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?
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.
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.
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))
Great idea! @james.mcmillanNYR6A
I completely forgot about the APIs, that would work great here.
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!
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?
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?
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
@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.
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.
Can't find what you're looking for? Ask the community or share your knowledge.