简体   繁体   中英

Is it possible to create a new Block from a VectorView of a 3D model?

Assume I have a 3D model imported from a step file. I have

  • Design design1 to work with a 3D imported model.
  • Drawing drawing where I create my 2D VectorView topView
  • Design design2 where I work on my actual design

I would like to create a Block from this topView to use in Design design2 and if I change the model in design1 and/or create another VectorView on drawing does not impact anything on design2 . The current workaround is to save the topView as a 2D CAD then import it back.

My code to read the 3D step file and place it to design1

var rf = new ReadSTEP(@"C:\\Sample3DModel.stp");

rf.DoWork();

rf.AddToScene(design1)

My code to create a vector view viewType.Top

            drawing.Sheets.Clear();

            //Empty sheet
            var sheet1 = new Sheet(linearUnitsType.Millimeters, 100, 100, "Sheet 1");

            var topView = new VectorView(80, 80, viewType.Top, sheet1.Scale, "Top");

            topView.HiddenSegments = false;

            topView.Selectable = false;

            sheet1.Entities.Add(topView);

            drawing.Sheets.Add(sheet1);

            drawing.Rebuild(design1);

            drawing.ActiveSheet = sheet1;

            drawing.Invalidate();

I tried to collect Entities from topView but error var entities = topView.GetEntities(new BlockKeyedCollection()); error: 'A Block with name Top does not exist.' var entities = topView.GetEntities(new BlockKeyedCollection()); error: 'A Block with name Top does not exist.'

Please try design1.CopyTo(design2) and you'll get an exact -deep- copy of what you have on design1 control.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM