When exporting a 3D-DWG to PDF-3D with the settings below, only the wireframe is visible in the output:
Aspose.CAD.ImageOptions.CadRasterizationOptions rasterizationOptions = new
Aspose.CAD.ImageOptions.CadRasterizationOptions();
rasterizationOptions.PageWidth = 5000;
rasterizationOptions.PageHeight = 5000;
rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;
rasterizationOptions.RenderMode3D = RenderMode3D.Solid;
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.Is3DContent = true;
We would like the model to appear in e.g. Acrobat Reader DC in shaded render mode.
Thanks
@geberit
When exporting a 3D DWG file to a PDF with the intention of displaying it in shaded render mode, it is important to ensure that the rasterization options are correctly configured. Based on your provided settings, it seems you are using the RenderMode3D.Solid
option, which is correct for achieving a shaded appearance. However, there are a few additional considerations to ensure that the output is rendered as expected.
Here’s a sample code snippet that demonstrates how to set up the rasterization options and export the DWG file to a PDF:
import com.aspose.cad.Image;
import com.aspose.cad.fileformats.cad.CadImage;
import com.aspose.cad.imageoptions.CadRasterizationOptions;
import com.aspose.cad.imageoptions.PdfOptions;
public class DWGToPDF3D {
public static void main(String[] args) {
String sourceFilePath = "path/to/your/3DModel.dwg";
String outPath = "path/to/output/3DModel.pdf";
CadImage cadImage = (CadImage) Image.load(sourceFilePath);
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
rasterizationOptions.setPageWidth(5000);
rasterizationOptions.setPageHeight(5000);
rasterizationOptions.setDrawType(CadDrawTypeMode.UseObjectColor);
rasterizationOptions.setRenderMode3D(RenderMode3D.Solid);
PdfOptions pdfOptions = new PdfOptions();
pdfOptions.setIs3DContent(true);
pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
cadImage.save(outPath, pdfOptions);
}
}
Make sure that the setLayouts
method is called if you want to specify which layout to render, as this can affect the output. If you are still only seeing the wireframe, ensure that the 3D model in the DWG file is properly defined and that the viewer you are using (like Acrobat Reader DC) supports the 3D rendering features.
If you continue to experience issues, consider checking the model’s properties in the CAD software to ensure that it is set up for shaded rendering. Additionally, ensure that you are using the latest version of Aspose.CAD, as updates may include improvements and bug fixes related to 3D rendering.
If you have further questions or need additional assistance, feel free to ask!
All our settings are correct to produce a shaded 3D-PDF, like in your answer. We specify the layout correctly:
public static void Run()
{
//ExStart:Export3DImagestoPDF
// The path to the documents directory.
string myDir = RunExamples.GetDataDir_ConvertingCAD();
string sourceFilePath = myDir + "Demo_3D.dwg";
using (Aspose.CAD.Image cadImage = Aspose.CAD.Image.Load(sourceFilePath))
{
CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions
{
PageWidth = 5000,
PageHeight = 5000,
RenderMode3D = RenderMode3D.Solid,
Layouts = new[] { "Model" }
};
PdfOptions pdfOptions = new PdfOptions
{
Is3DContent = true,
VectorRasterizationOptions = rasterizationOptions
};
myDir = myDir + "Demo_3D_out_2.pdf";
cadImage.Save(myDir, pdfOptions);
}
Console.WriteLine("\n3D images exported successfully to PDF.\nFile saved at " + myDir);
}
Please see the attached Demo-3D.dwg sample file.
Demo_3D.zip (6,5 MB)
The output should look like this:
Demo3D_DWG.png (32,8 KB)
What we get is this:
PDF_out.png (7,6 KB)
@geberit,
We have very limited support for 3D with shades unfortunately, we have created CADNET-10090 to consider possible improvements and extend support for visual styles.
Thank you for this clarification.
1 Like