Prod.: Engine, ver.: 6022, ID: 60000996, Wish : Export a drawing into simple lines as 2D and removing Hidden lines

Wish : Export a drawing into simple lines as 2D and removing Hidden lines

Article60000996
TypeWish
ProductEngine
Version6022
Date Added11/6/2009
FixedYes [4/26/2012]
Submitted byKerry Francis
Keywords

Subject

Export a drawing into simple lines as 2D and removing Hidden lines

Summary

Export a 3D drawing in Hide mode as 2D objects

Solution

The following new methods was added in version 6023 : 

1. GetModel2dProjection of vdDocument object
It gets three parameters:

and  returns: A collection of line segments that represents the 2D projection of the clipping for all objects in the Model Layout of the passed document.

Code Example:

   //prompts the user for a new section clip
   //generates a 2d projection line segments and add them into a new layout
            doc.Prompt("section origin");
            gPoint origin = doc.ActionUtility.getUserPoint() as gPoint;
            doc.Prompt(null);
            if(origin == null) return;
            doc.Prompt("section view direction");
            gPoint dir = doc.ActionUtility.getUserRefPoint(origin) as gPoint;
            doc.Prompt(null);
            linesegments segs = doc.GetModel2dProjection(origin,new Vector(origin, dir),0.0);
            vdLayout layout = doc.LayOuts.Add("section_2d_projection");
            layout.Entities.RemoveAll();
            foreach (linesegment line in segs)
            {
                 layout.Entities.AddItem(new vdLine(doc, line.StartPoint, line.EndPoint));
            }

  
2. ExportToLines of vdPrint object

Exports the printable view area into a vdDocument object that contains single lines for all drawing objects.

Remarks:
    Viewports of layouts are not exported.
    3D views are exported as in Hide rendering mode.
    Exported lines are clipped inside the vdPrint's PrintWindow area.
    Exported lines are transformed relative to printer paper in millimeters with origin the Upper Left corner.
    All lines are added in the Model layout of the return document object and belongs to default Layer "0" with foreground color.
    Exporting lines of a printer view into a vdcl file can be also done by setting the PrinterName to an existing file with .vdcl extension.


Code Example:

	// create a block of the model printer and add it into a new layout with name "model view"
                vdDocument blockDocument = doc.Model.Printer.ExportToLines();
                vdBlock block = doc.Blocks.AddFromDocument("modelview", blockDocument, true);
                vdLayout layout_with_modelview = doc.LayOuts.Add("model view");
                vdInsert insert = new vdInsert(doc,block,new gPoint(0,0),0.0,1.0,1.0,1.0);
                layout_with_modelview.Entities.AddItem(insert);
                doc.ActiveLayOut = layout_with_modelview;
                doc.CommandAction.Zoom("e", null, null);