Message 1 of 5
Export Flat Pattern to JPEG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I have a .NET application where I'm exporting an image of a flat pattern view. Here is a snippet...
SheetMetalComponentDefinition oSMCD = (SheetMetalComponentDefinition)oCD;
if (oSMCD.HasFlatPattern)
{
oSMCD.FlatPattern.Edit();
}
else
{
oSMCD.Unfold();
}
{
oSMCD.FlatPattern.Edit();
}
else
{
oSMCD.Unfold();
}
string sOut = "FLAT PATTERN DXF?AcadVersion=R12" + //R12 is the only DXF format which FormFabs can open
"&OuterProfileLayer=CUT" +
"&InteriorProfilesLayer=CUT" +
"&MergeProfilesIntoPolyline=True" +
"&InvisibleLayers=IV_TANGENT;IV_ARC_CENTERS" +
";IV_FEATURE_PROFILES_DOWN"; //this ensures etching doesn't accidentally end up reversed
if (noEtching)
{
sOut = sOut + ";IV_BEND;IV_BEND_DOWN;IV_FEATURE_PROFILES"; //Additional invisible layers
}
else
{
sOut = sOut +
"&UnconsumedSketchesLayer=ETCH" +
"&UnconsumedSketchesLayer Color=255;127;255" +
"&FeatureProfilesUpLayer=ETCH" +
"&FeatureProfilesUpLayerColor=255;127;255" +
"&BendLayer=ETCH" +
"&BendLayerColor=255;127;255" +
"&BendUpLayer=ETCH" +
"&BendUpLayerColor=255;127;255" +
"&BendDownLayer=ETCH" +
"&BendDownLayerColor=255;127;255";
}
"&OuterProfileLayer=CUT" +
"&InteriorProfilesLayer=CUT" +
"&MergeProfilesIntoPolyline=True" +
"&InvisibleLayers=IV_TANGENT;IV_ARC_CENTERS" +
";IV_FEATURE_PROFILES_DOWN"; //this ensures etching doesn't accidentally end up reversed
if (noEtching)
{
sOut = sOut + ";IV_BEND;IV_BEND_DOWN;IV_FEATURE_PROFILES"; //Additional invisible layers
}
else
{
sOut = sOut +
"&UnconsumedSketchesLayer=ETCH" +
"&UnconsumedSketchesLayer Color=255;127;255" +
"&FeatureProfilesUpLayer=ETCH" +
"&FeatureProfilesUpLayerColor=255;127;255" +
"&BendLayer=ETCH" +
"&BendLayerColor=255;127;255" +
"&BendUpLayer=ETCH" +
"&BendUpLayerColor=255;127;255" +
"&BendDownLayer=ETCH" +
"&BendDownLayerColor=255;127;255";
}
//Job Specific DXF
string jobSpecificFileNameWithPath = dxfFolder + "//" + oItem + ".dxf";
oCD.DataIO.WriteDataToFile(sOut, jobSpecificFileNameWithPath);
string jobSpecificFileNameWithPath = dxfFolder + "//" + oItem + ".dxf";
oCD.DataIO.WriteDataToFile(sOut, jobSpecificFileNameWithPath);
iDoc.SaveAs("C:" + "//" + "temp" + "//" + oItem + ".jpg", true);
The problem is that the JPEG exported is just a screenshot. I Could really do with the image exporting as solid black lines on a black background. I know its possible to set the 'Visual style' to 'Wireframe' through the API but the components end up barely visible because of the low line weight.
I've considered making it so that the script creates view in the Drawing environment but this seems a bit long winded. I know I could probably look at opening each of the DXFs up in AutoCAD but I don't have any experience with the AutoCAD API.
Wayne Helley
Inventor 2013 Certified Professional
Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
Inventor 2013 Certified Professional
Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit