Fabrication API: ItemCuttype missing and accessing scripts via C#

Anonymous

Fabrication API: ItemCuttype missing and accessing scripts via C#

Anonymous
Not applicable

First off, I seem to recall that there was a vote to have a Fabrication API forum. Would still love to have that available to us as we use it more and more. So I apologize if there might have been a better place to post this.

 

I am writing a Fabrication API Add-In for CAM and CAD, and I've reached a point where I need to read the item's Cut Type value. In the old MAP scripting, it was as easy as item.cuttype. And I even seem to recall this value being present in Revit's Fabrication Parts. But it does not seem to be present in Fabrication API for 2016. Is this correct? And can we change that?

 

In the assumption that this is not possible to achieve in 2016 (at least) from the Item itself, I've started looking into a way to see this value feeding my .NET addin with information coming from the old scripting language. So it needs to happy asynchronously so that it can give me the info and my addin can work with that.

 

Editor.CommandAsync does not seem to like the execute script command, so it appears I am left with the Interop SendCommand.

var adoc = Application.DocumentManager.MdiActiveDocument.GetAcadDocument();
(adoc as AutoCAD.AcadDocument).SendCommand("EXECUTESCRIPT\n\"C:\\test\\debug_cuttype.cod\"\n");

With this approach, even with FILEDIA set to 0 and this location set to my trusted locations, I still get a prompt to browse to the script, which I more or less expected but had to try. Even should I get around that, I'm curious how I'll receive the result other than a dialog.

 

Any thoughts on how to proceed here? 

0 Likes
Reply
Accepted solutions (1)
840 Views
3 Replies
Replies (3)

Anonymous
Not applicable

I've found the option to read the override of the cut type, if there is one. 

0 Likes

Anonymous
Not applicable
Accepted solution

 

Don't send the EXECUTESCRIPT command (which is what's causing the prompt to browse to the COD script).

 

Instead, call the "Executescript" lisp function which takes the COD script as a string arguement. 

 

Without testing (so verify syntax)...

SendCommand("(executescript \"c:\\test\\debug_cuttype.cod\")\n");

 

0 Likes

Anonymous
Not applicable

Yeah, while sitting on I-5 for 800 years, I remembered that I could send Lisp syntax right into the command line and that it should work with SendCommand, you are right. I've been in Revit too long. Thanks again Darren.

0 Likes