Ask me questions on the AutoCAD Exchange!

I'm this week's "expert" over on the AutoCAD Exchange:

AutoCAD Exchange - Ask the Expert

I don't know whether people visiting that site will be interested in asking programming-related questions, but as I'm routinely re-directing support questions I receive by email or as blog comments across to the ADN site or to our discussion groups, I thought I'd point this blog's readership at the chance to get questions answered without me wriggling out of them. 🙂

Go on – ask me a question!

5 responses to “Ask me questions on the AutoCAD Exchange!”

  1. Hey thanks to your answer and blog my app is working great now in paperspace and there is no UCS issues. CHEERS!

    Public Class FloorSurferView

    Private pMax As Point3d
    Private pMin As Point3d

    Public Sub New()
    SaveView()
    End Sub

    Private Sub SaveView()

    Dim ed As Editor = AC_App.DocumentManager.MdiActiveDocument.Editor

    Using acView As ViewTableRecord = ed.GetCurrentView()

    Dim pCenter As Point3d = New Point3d(acView.CenterPoint.X, acView.CenterPoint.Y, 0)
    pMin = New Point3d(pCenter.X - (acView.Width / 2), pCenter.Y - (acView.Height / 2), 0)
    pMax = New Point3d(pCenter.X + (acView.Width / 2), pCenter.Y + (acView.Height / 2), 0)

    End Using

    End Sub

    Public Sub Zoom()

    Dim app As AcadApplication = CType(Application.AcadApplication, AcadApplication)
    Dim lower() As Double = New Double() {pMin.X, pMin.Y, pMin.Z}
    Dim upper() As Double = New Double() {pMax.X, pMax.Y, pMax.Z}
    app.ZoomWindow(lower, upper)

    End Sub

    End Class

  2. Great - thanks for letting me know.

    Glad to be of help. 🙂

    Kean

  3. i've this exception each time i run my visual studio class library project using .net c# autocad api

    Application does not support just-in-time (JIT)
    debugging. See the end of this message for details.

    ************** Exception Text **************
    System.TypeInitializationException: The type initializer for 'Xbim.IO.Memory.MemoryModel' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' or one of its dependencies. The system cannot find the file specified.
    at Xbim.IO.Memory.MemoryModel..cctor()
    --- End of inner exception stack trace ---
    at Xbim.IO.Memory.MemoryModel.GetFileHeader(String fileName)
    at Xbim.Ifc.IfcStore.GetIfcSchemaVersion(String path, String& schemaIdentifier) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.Ifc\IfcStore.cs:line 378
    at Xbim.Ifc.IfcStore.Open(String path, XbimEditorCredentials editorDetails, Nullable`1 ifcDatabaseSizeThreshHold, ReportProgressDelegate progDelegate, XbimDBAccess accessMode) in C:\BuildAgent\work\77d7b8e93613846d\Xbim.Ifc\IfcStore.cs:line 285
    at CadLibrary.Class1.DrawModel() in c:\Users\lenovo\Desktop\CadLibrary\CadLibrary\Class1.cs:line 274
    at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
    at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
    at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()

    ************** Loaded Assemblies **************
    mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34011 built by: FX45W81RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
    ----------------------------------------
    Acdbmgd
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcdbMgd.DLL
    ----------------------------------------
    System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34003 built by: FX45W81RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    AdApplicationFrame
    Assembly Version: 0.0.0.0
    Win32 Version: 3.5.19.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AdApplicationFrame.DLL
    ----------------------------------------
    AdWindows
    Assembly Version: 3.5.21.0
    Win32 Version: 3.5.21.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AdWindows.DLL
    ----------------------------------------
    PresentationFramework
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34003
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
    ----------------------------------------
    WindowsBase
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34003 built by: FX45W81RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
    ----------------------------------------
    PresentationCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34003 built by: FX45W81RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
    ----------------------------------------
    System.Xaml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
    ----------------------------------------
    System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    PresentationFramework.Aero2
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero2/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero2.dll
    ----------------------------------------
    System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    accoremgd
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/accoremgd.DLL
    ----------------------------------------
    Acmgd
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/Acmgd.DLL
    ----------------------------------------
    AcWindows
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcWindows.DLL
    ----------------------------------------
    AcCui
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcCui.DLL
    ----------------------------------------
    PresentationFramework-SystemXml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXml/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXml.dll
    ----------------------------------------
    PresentationFramework.Aero
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
    ----------------------------------------
    WindowsFormsIntegration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.34003 built by: FX45W81RTMGDR
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsFormsIntegration/v4.0_4.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
    ----------------------------------------
    AcWindows.resources
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/en-US/AcWindows.resources.DLL
    ----------------------------------------
    PresentationUI
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationUI/v4.0_4.0.0.0__31bf3856ad364e35/PresentationUI.dll
    ----------------------------------------
    System.Xml.Linq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
    ----------------------------------------
    PresentationFramework-SystemXmlLinq
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXmlLinq/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXmlLinq.dll
    ----------------------------------------
    RibbonSample
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/ProgramData/Autodesk/ApplicationPlugins/myApp.bundle/Application/RibbonSample.dll
    ----------------------------------------
    ContextualTabSelectorRules
    Assembly Version: 0.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcWindows.dll
    ----------------------------------------
    System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    ManagedMC3
    Assembly Version: 6.4.0.0
    Win32 Version: 6.4.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/ManagedMC3.DLL
    ----------------------------------------
    PresentationFramework-SystemCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemCore/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemCore.dll
    ----------------------------------------
    UIAutomationTypes
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/UIAutomationTypes/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll
    ----------------------------------------
    AcLivePreviewContext
    Assembly Version: 0.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcWindows.dll
    ----------------------------------------
    AcLayer
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcLayer.DLL
    ----------------------------------------
    AcLayer.resources
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/en-US/AcLayer.resources.DLL
    ----------------------------------------
    PresentationFramework.Luna
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Luna/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Luna.dll
    ----------------------------------------
    AcMrUi
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/AcMrUI.DLL
    ----------------------------------------
    AcMrUi.resources
    Assembly Version: 19.0.0.0
    Win32 Version: 19.0.55.0.0
    CodeBase: file:///C:/Program%20Files/Autodesk/AutoCAD%202013/en-US/AcMrUi.resources.DLL
    ----------------------------------------
    UIAutomationProvider
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/UIAutomationProvider/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
    ----------------------------------------
    CadLibrary
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/lenovo/Desktop/CadLibrary/CadLibrary/bin/Debug/CadLibrary.dll
    ----------------------------------------
    Xbim.Ifc
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.1701.17250
    CodeBase: file:///C:/Users/lenovo/Desktop/CadLibrary/CadLibrary/bin/Debug/Xbim.Ifc.DLL
    ----------------------------------------
    Xbim.Common
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.1701.17250
    CodeBase: file:///C:/Users/lenovo/Desktop/CadLibrary/CadLibrary/bin/Debug/Xbim.Common.DLL
    ----------------------------------------
    Xbim.Ifc4
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.1701.17250
    CodeBase: file:///C:/Users/lenovo/Desktop/CadLibrary/CadLibrary/bin/Debug/Xbim.Ifc4.DLL
    ----------------------------------------
    Xbim.IO
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.1701.17250
    CodeBase: file:///C:/Users/lenovo/Desktop/CadLibrary/CadLibrary/bin/Debug/Xbim.IO.DLL
    ----------------------------------------
    ICSharpCode.SharpZipLib
    Assembly Version: 0.86.0.518
    Win32 Version: 0.86.0.518
    CodeBase: file:///C:/Users/lenovo/Desktop/CadLibrary/CadLibrary/bin/Debug/ICSharpCode.SharpZipLib.DLL
    ----------------------------------------
    Xbim.Ifc2x3
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.1701.17250
    CodeBase: file:///C:/Users/lenovo/Desktop/CadLibrary/CadLibrary/bin/Debug/Xbim.Ifc2x3.DLL
    ----------------------------------------

    ************** JIT Debugging **************
    Application does not support Windows Forms just-in-time (JIT)
    debugging. Contact the application author for more
    information.

    ========================== my code ===============================================

    [CommandMethod("DrawModel")]

    public static void DrawModel()
    {

    Document acDoc = Application.DocumentManager.MdiActiveDocument;
    Database acDb = acDoc.Database;
    using (DocumentLock docLock = acDoc.LockDocument())
    {
    using (Transaction trans = acDb.TransactionManager.StartTransaction())
    {
    //Create Block Table using Transaction for read
    BlockTable BlkTbl;
    BlkTbl = trans.GetObject(acDb.BlockTableId, OpenMode.ForWrite) as BlockTable;
    //Create Block Table Record using Transaction for write
    BlockTableRecord BlkTblRec;
    BlkTblRec = trans.GetObject(BlkTbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

    using (var model = IfcStore.Open("model.ifc"))
    {

    // walls
    List<string> wallnames = new List<string>();
    List<double> wallsdepth = new List<double>();
    List<double> wallslength = new List<double>();
    List<double> wallswidth = new List<double>();
    List<point2d> wallspoints = new List<point2d>();

    var allWalls = model.Instances.OfType<ifcwallstandardcase>();
    foreach (var wall in allWalls)
    {
    double Length = ((((wall.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid) as
    IfcSweptAreaSolid).SweptArea) as IfcRectangleProfileDef).XDim;
    double Depth = (wall.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid).Depth;
    double width = ((((wall.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid) as
    IfcSweptAreaSolid).SweptArea) as IfcRectangleProfileDef).YDim;
    Point2d Center = new Point2d(((((((wall.ObjectPlacement) as IfcLocalPlacement).RelativePlacement) as IfcAxis2Placement3D).Location) as IfcCartesianPoint).X, ((((((wall.ObjectPlacement) as IfcLocalPlacement).RelativePlacement) as IfcAxis2Placement3D).Location) as IfcCartesianPoint).Y);

    wallnames.Add(wall.Name);
    wallsdepth.Add(Depth);
    wallslength.Add(Length);
    wallswidth.Add(width);
    wallspoints.Add(Center);

    Point3d upperLeft = new Point3d(Center.X - (Length / 2), Center.Y + (width / 2), 0);
    Point3d upperRight = new Point3d(Center.X + (Length / 2), Center.Y + (width / 2), 0);
    Point3d lowerLeft = new Point3d(Center.X - (Length / 2), Center.Y - (width / 2), 0);
    Point3d lowerRight = new Point3d(Center.X + (Length / 2), Center.Y - (width / 2), 0);
    Line L1 = new Line(upperLeft, upperRight);
    Line L2 = new Line(lowerLeft, upperRight);
    Line L3 = new Line(upperLeft, lowerLeft);
    Line L4 = new Line(lowerLeft, lowerRight);
    L1.SetDatabaseDefaults();
    L2.SetDatabaseDefaults();
    L3.SetDatabaseDefaults();
    L4.SetDatabaseDefaults();
    //L1.ColorIndex = 1;
    //L2.ColorIndex = 1;
    //L3.ColorIndex = 1;
    //L4.ColorIndex = 1;

    //Add PolyLine to Block Table Record and Transaction
    BlkTblRec.AppendEntity(L1);
    trans.AddNewlyCreatedDBObject(L1, true);
    BlkTblRec.AppendEntity(L2);
    trans.AddNewlyCreatedDBObject(L2, true);
    BlkTblRec.AppendEntity(L3);
    trans.AddNewlyCreatedDBObject(L3, true);
    BlkTblRec.AppendEntity(L4);
    trans.AddNewlyCreatedDBObject(L4, true);
    trans.Commit();

    }

    // columns

    List<string> columnsnames = new List<string>();
    List<double> columnsdepth = new List<double>();
    List<double> columnslength = new List<double>();
    List<double> columnswidth = new List<double>();
    List<point2d> columnsspoints = new List<point2d>();

    var allColumns = model.Instances.OfType<ifccolumnstandardcase>();
    foreach (var column in allColumns)
    {
    double Length = ((((column.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid) as
    IfcSweptAreaSolid).SweptArea) as IfcRectangleProfileDef).XDim;
    double Depth = (column.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid).Depth;
    double width = ((((column.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid) as
    IfcSweptAreaSolid).SweptArea) as IfcRectangleProfileDef).YDim;
    Point2d Center = new Point2d(((((((column.ObjectPlacement) as IfcLocalPlacement).RelativePlacement) as IfcAxis2Placement3D).Location) as IfcCartesianPoint).X, ((((((column.ObjectPlacement) as IfcLocalPlacement).RelativePlacement) as IfcAxis2Placement3D).Location) as IfcCartesianPoint).Y);

    columnsnames.Add(column.Name);
    columnsdepth.Add(Depth);
    columnslength.Add(Length);
    columnswidth.Add(width);
    columnsspoints.Add(Center);

    Point3d upperLeft = new Point3d(Center.X - (Length / 2), Center.Y + (width / 2), 0);
    Point3d upperRight = new Point3d(Center.X + (Length / 2), Center.Y + (width / 2), 0);
    Point3d lowerLeft = new Point3d(Center.X - (Length / 2), Center.Y - (width / 2), 0);
    Point3d lowerRight = new Point3d(Center.X + (Length / 2), Center.Y - (width / 2), 0);
    Line L1 = new Line(upperLeft, upperRight);
    Line L2 = new Line(lowerLeft, upperRight);
    Line L3 = new Line(upperLeft, lowerLeft);
    Line L4 = new Line(lowerLeft, lowerRight);
    L1.SetDatabaseDefaults();
    L2.SetDatabaseDefaults();
    L3.SetDatabaseDefaults();
    L4.SetDatabaseDefaults();

    //L1.ColorIndex = 2;
    //L2.ColorIndex = 2;
    //L3.ColorIndex = 2;
    //L4.ColorIndex = 2;

    //Add PolyLine to Block Table Record and Transaction
    BlkTblRec.AppendEntity(L1);
    trans.AddNewlyCreatedDBObject(L1, true);
    BlkTblRec.AppendEntity(L2);
    trans.AddNewlyCreatedDBObject(L2, true);
    BlkTblRec.AppendEntity(L3);
    trans.AddNewlyCreatedDBObject(L3, true);
    BlkTblRec.AppendEntity(L4);
    trans.AddNewlyCreatedDBObject(L4, true);
    trans.Commit();

    }

    //slabs
    List<string> slabssnames = new List<string>();
    List<double> slabssdepth = new List<double>();
    List<double> slabslength = new List<double>();
    List<double> slabswidth = new List<double>();
    List<point2d> slabspoints = new List<point2d>();

    var allslabs = model.Instances.OfType<ifccolumnstandardcase>();
    foreach (var slab in allslabs)
    {
    double Length = ((((slab.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid) as
    IfcSweptAreaSolid).SweptArea) as IfcRectangleProfileDef).XDim;
    double Depth = (slab.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid).Depth;
    double width = ((((slab.Representation.Representations[0].Items[0] as IfcExtrudedAreaSolid) as
    IfcSweptAreaSolid).SweptArea) as IfcRectangleProfileDef).YDim;
    Point2d Center = new Point2d(((((((slab.ObjectPlacement) as IfcLocalPlacement).RelativePlacement) as IfcAxis2Placement3D).Location) as IfcCartesianPoint).X, ((((((slab.ObjectPlacement) as IfcLocalPlacement).RelativePlacement) as IfcAxis2Placement3D).Location) as IfcCartesianPoint).Y);
    slabssnames.Add(slab.Name);
    slabssdepth.Add(Depth);
    slabslength.Add(Length);
    slabswidth.Add(width);
    slabspoints.Add(Center);
    Point3d upperLeft = new Point3d(Center.X - (Length / 2), Center.Y + (width / 2), 0);
    Point3d upperRight = new Point3d(Center.X + (Length / 2), Center.Y + (width / 2), 0);
    Point3d lowerLeft = new Point3d(Center.X - (Length / 2), Center.Y - (width / 2), 0);
    Point3d lowerRight = new Point3d(Center.X + (Length / 2), Center.Y - (width / 2), 0);
    Line L1 = new Line(upperLeft, upperRight);
    Line L2 = new Line(lowerLeft, upperRight);
    Line L3 = new Line(upperLeft, lowerLeft);
    Line L4 = new Line(lowerLeft, lowerRight);

    L1.SetDatabaseDefaults();
    L2.SetDatabaseDefaults();
    L3.SetDatabaseDefaults();
    L4.SetDatabaseDefaults();

    //Add PolyLine to Block Table Record and Transaction
    BlkTblRec.AppendEntity(L1);
    trans.AddNewlyCreatedDBObject(L1, true);
    BlkTblRec.AppendEntity(L2);
    trans.AddNewlyCreatedDBObject(L2, true);
    BlkTblRec.AppendEntity(L3);
    trans.AddNewlyCreatedDBObject(L3, true);
    BlkTblRec.AppendEntity(L4);
    trans.AddNewlyCreatedDBObject(L4, true);
    trans.Commit();
    }

    // Save in Data Base
    trans.Commit();

    }
    }

    }

  4. Hi Kean Walmsley,

    Merging of drawing files from a selected folder into a single single file.Scale of the data should not change

    Thank you so much that your posts helped me lot.
    Thank you and Warm Regards
    Suresh

    1. Hi Suresh,

      Please post your support questions to the relevant Autodesk forum.

      Best,

      Kean

Leave a Reply to Nathan Cancel reply

Your email address will not be published. Required fields are marked *