CAD creates an irregular-shape View

Source: Internet
Author: User
Tags polyline

Select multiple lines in the CAD model space and create a view in the specified layout. The method is as follows:

1 /// <summary> 2 /// create a 3 // </Summary> 4 /// <Param name = "roundline"> model space multi-line </Param> 5 // <Param name = "curentlayout"> current layout name </param> 6 /// <Param name = "insertpoint"> insert point of the layout space view </Param> 7 // <Param name = "scale"> scale </param> 8 private void makeviewport (polyline roundline, string curentlayout, point3d insertpoint, double scale) 9 {10 database DB = hostapplicationservices. workingdatabase; 11 using (transaction TRAN = dB. transactionmanager. starttransaction () 12 {13 blocktable bt = Tran. getObject (dB. blocktableid, openmode. forread) as blocktable; 14 blocktablerecord BTR = Tran. getObject (BT [blocktablerecord. paperspace], openmode. forwrite) as blocktablerecord; 15 16 polyline bound = roundline. clone () as polyline; 17 bound. closed = true; 18 point3d maxpoint = bound. geometricextents. maxpoint; 19 point3d minpoint = bound. geometricextents. minpoint; 20 point3d centerpoint = new point3d (maxpoint. X + minpoint. x)/2, (maxpoint. Y + minpoint. y)/2, 0); 21 bound. transformby (matrix3d. scaling (scale, centerpoint); 22 bound. transformby (matrix3d. displacement (centerpoint. getvectorto (insertpoint); 23 BTR. appendentity (bound); 24 Tran. addnewlycreateddbobject (bound, true); 25 26 viewport Vp = new viewport (); 27 BTR. appendentity (VP); 28 Tran. addnewlycreateddbobject (VP, true); 29 VP. nonrectclipentityid = bound. ID; 30 31 VP. centerpoint = insertpoint; // specifies the position of the insert into the view. viewcenter = new point2d (centerpoint. x, centerpoint. y); // model space center position 33 34 VP. viewheight = maxpoint. y-minpoint. y; // model space height 35 VP. height = scale * VP. viewheight; // the height of a 36 VP. nonrectclipon = true; 37 VP. locked = true; 38 VP. on = true; 39 Tran. commit (); 40} 41}

 

CAD creates an irregular-shape View

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.