I would like to get wall component info (location & size) of a wall style. Is this possible? Could anyone give me a nudge in the right direction?
Thanks.
Chris
Hi Chris,
@ChrisPicklesimer wrote:I would like to get wall component info (location & size) of a wall style. Is this possible? Could anyone give me a nudge in the right direction?
Thanks.
Chris
Yes, it's possible, We can access wall start & end point, wall style, size from programtically, Use .net api you can easily get the requirements.
Thanks,
Malli.
Can you elaborate a little about how to access wall style via API?
I even cant find StyleName
public static Autodesk.AutoCAD.DatabaseServices.ObjectId GetWallStyleId(string name, Database db, Transaction trans)
{
Autodesk.AutoCAD.DatabaseServices.ObjectId wallStyleId = Autodesk.AutoCAD.DatabaseServices.ObjectId.Null;
DictionaryWallStyle wallStyleDict = new DictionaryWallStyle(db);
if (wallStyleDict.Has(name, trans))
{
wallStyleId = wallStyleDict.GetAt(name);
}
return (wallStyleId);
}
I use this to get the wall style name by passing in the ID of wall object.
Snippet
Public Function GetWallStyleName(ByVal objID As ObjectID) As String Dim sReturn As String = "" Dim db As Database = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase Using tr As Transaction = db.TransactionManager.StartTransaction() Dim objWall As Wall = CType(tr.GetObject(objID, OpenMode.ForRead, False), Wall) Dim styleID As ObjectID = objWall.StyleId Dim objWallStyle As WallStyle = CType(tr.GetObject(styleID, OpenMode.ForRead, False), WallStyle) Dim strWallStyleName As String = objWallStyle.Name sReturn = strWallStyleName.ToString tr.Commit() End Using Return sReturn End Function