我正在尝试将现有的Revit Addin转换为在Forge Design Automation上运行。在我的代码中,我有一个导入DWG文件的步骤。如果我将DWG文件作为输入参数传递,如何在代码中引用它来导入文件?此外,如何在"活动命令行"中将RFA文件指定为输入而不是RVT?
“commandLine": [ "$(engine.path)\\revitcoreconsole.exe /i $(args[rvtFile].path) /al $(appbundles[CountItApp].path)" ],”
以下的当前代码
//获取文档_rvtDoc=命令Data.Application.ActiveUIDocument.Document;
DWGImportOptions DIO = new DWGImportOptions();
DIO.ColorMode = ImportColorMode.Preserved;
//DIO.Unit = ImportUnit.Foot;
DIO.CustomScale = 1.00;
DIO.Placement = ImportPlacement.Origin;
ElementId eleID = new ElementId(1234);
string path = @"C:LoganBIM DevReference FilesNewTestVAV_Exploded.dwg";
View nv = _rvtDoc.ActiveView;
要将DWG文件作为输入文件传递,需要:
-
在您的活动中再添加一个参数,如:
"inputDwg": { "verb": "get", "description": "input Dwg file", "localName": "input.dwg" },
-
然后,在工作项中传递dwg的url。
-
处理插件中的Dwg文件,代码应该与您所拥有的非常相似,但请记住,您不能文档化。ActiveView由于不起作用,您需要手动获取它,并且Dwg文件的路径应该是Directory.GetCurrentDirectory((+@"\input.Dwg">
DWGImportOptions DIO = new DWGImportOptions(); DIO.ColorMode = ImportColorMode.Preserved; //DIO.Unit = ImportUnit.Foot; DIO.CustomScale = 1.00; DIO.Placement = ImportPlacement.Origin; ElementId eleID = new ElementId(1234); string path = Directory.GetCurrentDirectory()+@"input.dwg"; View nv = //Find the view you want here doc.Import(path, DIO, nv, eleId );
希望它能有所帮助;(