The Drawing workspace

Drawing is the Eyeshot workspace where you can create and annotate high-quality 2D views of your 3D geometry.

mceclip0.png

Sheet

The Drawing can be made up of one or more Sheets and each Sheet can contain a title block and multiple views. The current sheet is the one set in Drawing.ActiveSheet property.

Title Block

The title block is a block reference containing information about the author, the date, the scaling factor, and any logos and additional information needed.

You can use Sheet's helper methods named BuildXXX() to quickly build some standard title blocks format.

// Creates new sheet
Sheet sheet1 = new Sheet(linearUnitsType.Millimeters, 210, 297, "Sheet 1");
// Gets the title block for A4 Iso standard format
BlockReference br = sheet1.BuildA4ISO(out Block a4Block, "A4_ISO");
// Initializes title block's attributes
br.Attributes["Title"] = new AttributeReference("My First Sheet");
br.Attributes["Format"] = new AttributeReference("A4");
br.Attributes["DwgNo"] = new AttributeReference("Root");
br.Attributes["Scale"] = new AttributeReference("SCALE: 1:2");
br.Attributes["Sheet"] = new AttributeReference("SHEET 1 OF 1");
// Adds the block related to the title block to the Blocks collection
drawing1.Blocks.Add(a4Block);
// Adds its reference to the sheet
sheet1.Entities.Add(br);
// Adds the sheet to the Sheets collection
drawing1.Sheets.Add(sheet1);
// Sets the sheet as the active one
drawing1.ActiveSheet = sheet1;
// Refresh the control
drawing1.Invalidate();

All these helper methods internally call some other sheet's virtual method like CreateTitleBlock(), CreateBorder(), CreateBorderSeparators(), etc. that you can customize by overriding them. For instance, here is how to add the value of an optional "Status" attribute to the title block:

public class MySheet : Sheet
{
    public MySheet(linearUnitsType units, double width, double height,
        string name) : base(units, width, height, name)
    {
    }

    protected override Entity[] CreateTitleBlock(double borderWidth,
        Color color, float lineWeight = 0.15F)
    {
        const int row = 2, col = 5;
        const double textHeight = 2;
        const string tag = "Rating";

        var entitiesArray = base.CreateTitleBlock(
            borderWidth, color, lineWeight);
        var entities = new List<Entity>(entitiesArray);
        var table = entities.OfType<Table>().FirstOrDefault();

        if (table == null)
            return entities.ToArray();

        table.MergeCells(row, col, row, col + 1);
        table.SetTextString(row, col, tag.ToUpper() + ":");
        table.SetAlignment(row, col, devDept.Eyeshot.Entities.Text.alignmentType.TopLeft);
        entities.Add(new devDept.Eyeshot.Entities.Attribute(
            table.GetCenter(row, col),
            tag,
            string.Empty,
            textHeight)
        {
            Alignment = devDept.Eyeshot.Entities.Text.alignmentType.MiddleCenter
        });

        return entities.ToArray();
    }
}

If you like the standard title blocks but you want to customize the logo, you just need to override the GetLogo() method.

We represent the title block through a single Table entity, but you can use one or more entities according to your goal.

View

The main entities of this workspace are the Views, which are grouped into RasterViews and VectorViews. 

The AddViewPlaceHolder() method allows you to add a view's placeholder while waiting for the build of the view itself.

VectorView vectorView = new VectorView(100, 130, viewType.Front, 0.5, "Sheet1 Front Vector View");
RasterView rasterView = new RasterView(300, 130, viewType.Trimetric, 0.5, "Sheet1 Trimetric Raster View");
sheet1.AddViewPlaceHolder(vectorView, design1, drawing1, "Front Vector View");
sheet1.AddViewPlaceHolder(rasterView, design1, drawing1, "Trimetric Raster View");

Once you placed the views on the sheet (or you simply need to update them) just call the rebuild method to start building the sheets:

drawing1.Rebuild(design1, async, dirtyOnly);

Changing some properties of the view can make it become "dirty" or "old". In this case, the selection's rectangle will be drawn as in the following image.

mceclip0.png

To update those views, you can call the Rebuild() method as explained before.

If something is changed on the Design workspace instead, you can just call the Rebuild() method with the changedOnly parameter set to false to update all the views at once (see Video)

For a more detailed sample that illustrates the Drawing workspace and its advanced features, you can check our PaperDemo sample.

Was this article helpful?
0 out of 0 found this helpful

Comments

2 comments
Date Votes
  • Hello, this feature is really great! I just don't understand how to change the logo?

    0
  • Hi Alice,

    For any doubt or issue regarding the product you can also open a support ticket.

    To customize the logo you should derive the Sheet Class and return your own entities as follows:

    class MySheet : Sheet
    {
        MySheet(Sheet another) : base(another)
        {

        }

        protected override Entity[] CreateTitleBlock(double borderWidth, Color color, float lineWeight = 0.15)
        {
           // your title block: return the list of entity of you title block
          // return base.CreateTitleBlock(); // do not call the base       
        }

        protected override Entity[] GetLogo()
        {
           // your logo: return the list of entity of you logo (you can usee a Picture entity for a raster image)
          // return base.GetLogo(); // do not call the base
        }
    }
    1

Please sign in to leave a comment.

Articles in this section