Chuyển đến nội dung
Diễn đàn CADViet

viet_design

Thành viên
  • Số lượng nội dung

    8
  • Đã tham gia

  • Lần ghé thăm cuối

Bài đăng được đăng bởi viet_design


  1. Em xin lỗi anh nha, hì hôm đó em bận việc quá đánh câu hỏi up lên chưa kịp nhìn nữa ^.^. Ý em là em tạo 1 đường Line, rectangle,point... khi xuất ra thì phải chọn điểm đặt của những đối tượng đó trong cad. Anh viết giùm em code chon điẻm đặt cho đối tượng khi xuất ra giùm em  nha anh. Cảm ơn anh trước nha.


  2. Bác nào pro giúp mình hoàn thiện tạo một dimension style đầy đủ bằng c# với, mình chỉ làm được đến phần tạo name dimension thôi, ngoài ra tạo dimension lines ( color...), kích thước arrowheads,text appearance thì mình mù tịch. Mình xin cảm ơn pro trước nha.  code của mình create name dimension trong file dưới đây. using System; using System.Collections.Generic; using System.Linq; using System.Text; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime;   namespace ClassLibrary1 {     public class Class1     {           [CommandMethod("ODS")]         public void OverrideDimensionStyle()         {             Document acdoc = Application.DocumentManager.MdiActiveDocument;             Database accurdb = acdoc.Database;             Transaction tr = accurdb.TransactionManager.StartTransaction();             using (tr)             {                 DimStyleTable dst = (DimStyleTable)tr.GetObject(accurdb.DimStyleTableId, OpenMode.ForWrite);                 DimStyleTableRecord dstr = new DimStyleTableRecord();                 dstr.Dimtad = 2;                 dstr.Dimgap = 0.3;                 dstr.Name = "MyStyle";                 ObjectId dsId = dst.Add(dstr);                 tr.AddNewlyCreatedDBObject(dstr, true);                                 AlignedDimension ad1 = new AlignedDimension(Point3d.Origin, new Point3d(5.0, 0.0, 0.0), new Point3d(2.5, 2.0, 0.0), "MyStyle", dsId);                 AlignedDimension ad2 = new AlignedDimension(new Point3d(5.0, 0.0, 0.0), new Point3d(10.0, 0.0, 0.0), new Point3d(7.5, 2.0, 0.0), "Overridden dimension", dsId);                 ad2.Dimtad = 4;                 ad2.Dimgap = 0.5;                 BlockTableRecord btr = (BlockTableRecord)tr.GetObject(accurdb.CurrentSpaceId, OpenMode.ForWrite);                 btr.AppendEntity(ad1);                 btr.AppendEntity(ad2);                 tr.AddNewlyCreatedDBObject(ad1, true);                 tr.AddNewlyCreatedDBObject(ad2, true);                 tr.Commit();             }  

×