Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Evening
I'm new to AutoCAD .NET API ,and trying to create simple code to create box, and its worked.
but AutoCAD put the centroid of the box in 0,0,0
How to change it
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
[assembly:ExtensionApplication(typeof(CreateBox.box3dcreator))]
namespace CreateBox
{
public class box3dcreator:IExtensionApplication
{
[CommandMethod("boxtest")]
public void boxc()
{
Database dbs = HostApplicationServices.WorkingDatabase;
Transaction trans = dbs.TransactionManager.StartTransaction();
ObjectId modsps = dbs.CurrentSpaceId;
BlockTableRecord blkrec = trans.GetObject(modsps, OpenMode.ForWrite) as BlockTableRecord;
Point3d cpnt = new Point3d(05, 12.50, 2.50);
Solid3d boxx = new Solid3d();
boxx.CreateBox(10, 25, 5);// how to assigning centroid ?
blkrec.AppendEntity(boxx);
trans.AddNewlyCreatedDBObject(boxx, true);
trans.Commit();
}
void IExtensionApplication.Initialize()
{
}
void IExtensionApplication.Terminate()
{
}
}
}
Solved! Go to Solution.