DGN Export settings

DGN Export settings

Anonymous
Not applicable
1,441 Views
11 Replies
Message 1 of 12

DGN Export settings

Anonymous
Not applicable

Hi there,

 

I'm trying to automate DGN export in Revit 2014/2015. I have tried this code :

 

public bool ExportDGN(Document document, View view)
{
bool exported = false;
// Get predefined setups and export the first one
IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);
if (setupNames.Count > 0)
{
// Get predefined options for first predefined setup
DGNExportOptions dgnOptions = DGNExportOptions.GetPredefinedOptions(document, setupNames[0]);

// export the active view if it is printable
if (document.ActiveView.CanBePrinted == true)
{
ICollection<ElementId> views = new List<ElementId>();
views.Add(view.Id);
exported = document.Export(Path.GetDirectoryName(document.PathName),
Path.GetFileNameWithoutExtension(document.PathName), views, dgnOptions);
}
}

return exported;

 

 

However, this line doesn't return any setups.

IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);

 

I have tried everything :

IList<string> setupNames = DGNExportOptions.GetPredefinedSetupNames(document);

IList<string> setupNames = ACADExportOptions.GetPredefinedSetupNames(document);

IList<string> setupNames = CADExportOptions.GetPredefinedSetupNames(document);

 

 

I receive the setups for DWG, but not for DGN.

Does anyone experience the same problem ?

 

0 Likes
Accepted solutions (1)
1,442 Views
11 Replies
Replies (11)
Message 2 of 12

Aaron.Lu
Autodesk
Autodesk

Dear R:

 

I don't see any problem in your code.

That might because there is no predefined DGN settings in your document.

Please check Revit>Export>CAD Formats>DGN>Select Export Setup, in the combobox did you see any predefined settings? if not, then Click the "Modify Export Setup" button, in the popup dialog, in the left bottom corner, click "New Export Setup"



Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 3 of 12

Anonymous
Not applicable
Hello Aaron,

Here is where Revit has some strange behavior.

When I export to dwg and there is no export setup (actually it says 'in-session export setup'), there is still an autocad drawing exported.

When I try the same for dgn, there isn't ??

So 'in-session export setup doesn't work for dgn. When I make an export setup first and use this one, the dgn export works.

SO, my question is, why is there this difference and how can I export to dgn with the default standard in-session export setup ?



Met vriendelijke groet,

ing. Remy van den Bor
ICN Solutions B.V.


[icnsolutions-logo.jpg]


Europalaan 14-18, 5232 BC 's-Hertogenbosch
Postbus 3302, 5203 DH 's-Hertogenbosch
Telefoon +31 (0)73 750 6 750
E-mail R.van.den.Bor@ICN-Solutions.nl
Internet www.ICN-Solutions.nl
Twitter www.twitter.com/icnsolutions
0 Likes
Message 4 of 12

Aaron.Lu
Autodesk
Autodesk
If DWG export only has "in-session export setup", then how did you get the ExportOptions argument? because you can query an existing one, you should create a new one, if that is the case, then for DGN you can also create a new one.


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 5 of 12

Anonymous
Not applicable
Well,

I've tried in Revit 2014 and 2015.

If have made 1 setup called DWGsetup and I've made 1 dgn setup called DGNSetup.

var dwgExportOptions = DWGExportOptions.GetPredefinedSetupNames();
This will return a value of 1 being the DWGsetup.

var dgnExportOptions = DGNExportOptions.GetPredefinedSetupNames();
This will return a value of 0 and NOT the expected DGNsetup ???

Even this :

var baseExportOptions = BaseExportOptions.GetPredefinedSetupNames();
This returns a value of 1 being the DWGsetup, but I would expect to get 2 setups back, being the DWGsetup AND DGNsetup. ???

So, every which way I try I only get a collection of 1 setup back, and that's the DWG setup.


Met vriendelijke groet,

ing. Remy van den Bor
ICN Solutions B.V.


[icnsolutions-logo.jpg]


Europalaan 14-18, 5232 BC 's-Hertogenbosch
Postbus 3302, 5203 DH 's-Hertogenbosch
Telefoon +31 (0)73 750 6 750
E-mail R.van.den.Bor@ICN-Solutions.nl
Internet www.ICN-Solutions.nl
Twitter www.twitter.com/icnsolutions
0 Likes
Message 6 of 12

Aaron.Lu
Autodesk
Autodesk
Would you please upload your rvt file?
I did a test on Revit 2015, if only "in-session export setup" exists for both settings, I will get 0 options from both of them.
If I create 1 setting for both of them seperately, it returns 1 for DWG and 1 for DGN.


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 7 of 12

Aaron.Lu
Autodesk
Autodesk
Wait a moment, I found those methods always return the same list of strings...

e.g.
var ops = DGNExportOptions.GetPredefinedSetupNames(this.Document);
var ops2 = DWGExportOptions.GetPredefinedSetupNames(this.Document);
var ops3 = DXFExportOptions.GetPredefinedSetupNames(this.Document);

all of the above will return the same name list, did you see the same problem?


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 8 of 12

Anonymous
Not applicable
Yes, i did. All methods always return the setups for the dwg. It will never return the dgn setups.
0 Likes
Message 9 of 12

Aaron.Lu
Autodesk
Autodesk
Ok, I will report an issue for it. Thanks very much to raise this problem.


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 10 of 12

Aaron.Lu
Autodesk
Autodesk
Accepted solution
There is another workaround: using ElementFilter to Filter ExportDGNSettings.

http://adndevblog.typepad.com/aec/2014/12/revitapi-how-to-get-dwgexportoptions.html

you can have a try


Aaron Lu
Developer Technical Services
Autodesk Developer Network
Message 11 of 12

Aaron.Lu
Autodesk
Autodesk
REVIT-59240 is logged for this issue. thanks.


Aaron Lu
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 12 of 12

Anonymous
Not applicable
Yes, with the filtered collection it works 🙂 Thanx for the help.


Kind regards,

ing. Remy van den Bor
ICN Solutions B.V.


[icnsolutions-logo.jpg]


Europalaan 14-18, 5232 BC 's-Hertogenbosch
Postbus 3302, 5203 DH 's-Hertogenbosch
Telefoon +31 (0)73 750 6 750
E-mail R.van.den.Bor@ICN-Solutions.nl
Internet www.ICN-Solutions.nl
Twitter www.twitter.com/icnsolutions
0 Likes