Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Kerry

Pages: [1]
1
.NET newbies / Re: Links to web ressources
« on: April 23, 2011, 06:42:14 AM »

Patriiick

You seem to have forgotten one of the better and longstanding forums
http://www.theswamp.org/index.php?board=27.0


2
.NET newbies / Re: How can i view an ACAD file using DOTNET
« on: February 12, 2011, 03:16:14 AM »

target audience:{intermediate}

hi,

Point2d p1=new Point2d(0,0);
Point2d p2=new Point2d(35,30);
line s=new line(p1,p2);

This above code sounds like "FILENOTFOUND EXCEPTION"


What are you developing with ??
The IDE should tell you that line is not recognised

The Class is Line.

3
AutoCAD talk / Re: Programming languages and AutoCAD
« on: December 07, 2010, 11:56:21 AM »

OK, we're using the same definition.
I don't think I need consider it in the remainder of my working life :)

4
AutoCAD talk / Re: Programming languages and AutoCAD
« on: December 07, 2010, 09:44:03 AM »

Quote
I am not particularly in favor of LISP

Lisp is where the novice programmer/customiser can make great gains. To disregard Lisp (as an AutoCAD user) is questionable in my opinion.

Quote
My theory is that a natural language interface would be feasible, not in the vast computer domain, but in the narrow field of the AutoCAD object model.

Patrick
What do you mean by " a natural language interface" ??
And are you proposing "another" specialised limited usage language for us to learn ?

5
Layouts and printing / Re: Get the current layout
« on: November 27, 2010, 10:18:35 AM »
Interesting. I did not know IL code could be read, how do you do that?  :pasmal:


target audience:{intermediate}

Hello Patrick,
 
2 ways

either with ILDASM.exe  http://msdn.microsoft.com/en-us/library/f7dy01k1(v=VS.100).aspx
or with .NET Reflector http://www.red-gate.com/products/reflector/index.htm

The .net Reflector may be better as you can view a DLL as  C#, VB, C++, F#, .... quite handy some times.


6
Layouts and printing / Re: Get the current layout
« on: November 27, 2010, 02:54:56 AM »
Greetings Gentlemen.

The transaction IS Disposed automatically when contained in a using statement.

For example, the following c# code when viewed as IL code (Intermediate Language as Compiled) shows the dispose statement.

Code: [Select]
[CommandMethod("DrawALine")]
public static void DrawALine()
{
    Database db = Application.DocumentManager.MdiActiveDocument.Database;
    Point3d startPoint = new Point3d(0.0, 0.0, 0.0);
    Point3d endPoint = new Point3d(10.0, 20.0, 30.0);
    Line myLine = new Line(startPoint, endPoint);
    using (Transaction tr = db.TransactionManager.StartTransaction())
    {
        BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
        (tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord).AppendEntity(myLine);
        tr.AddNewlyCreatedDBObject(myLine, true);
        tr.Commit();
    }
}

Code: [Select]
method public hidebysig static void DrawALine() cil managed
{
    .custom instance void [acmgd]Autodesk.AutoCAD.Runtime.CommandMethodAttribute::.ctor(string) = { string('DrawALine') }
    .maxstack 4
    .locals init (
        [0] class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Database db,
        [1] valuetype [acdbmgd]Autodesk.AutoCAD.Geometry.Point3d startPoint,
        [2] valuetype [acdbmgd]Autodesk.AutoCAD.Geometry.Point3d endPoint,
        [3] class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Line myLine,
        [4] class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Transaction tr,
        [5] class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.BlockTable bt,
        [6] class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.BlockTableRecord btrMS,
        [7] bool CS$4$0000)
    L_0000: nop
    L_0001: call class [acmgd]Autodesk.AutoCAD.ApplicationServices.DocumentCollection [acmgd]Autodesk.AutoCAD.ApplicationServices.Application::get_DocumentManager()
    L_0006: callvirt instance class [acmgd]Autodesk.AutoCAD.ApplicationServices.Document [acmgd]Autodesk.AutoCAD.ApplicationServices.DocumentCollection::get_MdiActiveDocument()
    L_000b: callvirt instance class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Database [acmgd]Autodesk.AutoCAD.ApplicationServices.Document::get_Database()
    L_0010: stloc.0
    L_0011: ldloca.s startPoint
    L_0013: ldc.r8 0
    L_001c: ldc.r8 0
    L_0025: ldc.r8 0
    L_002e: call instance void [acdbmgd]Autodesk.AutoCAD.Geometry.Point3d::.ctor(float64, float64, float64)
    L_0033: nop
    L_0034: ldloca.s endPoint
    L_0036: ldc.r8 10
    L_003f: ldc.r8 20
    L_0048: ldc.r8 30    L_0051: call instance void [acdbmgd]Autodesk.AutoCAD.Geometry.Point3d::.ctor(float64, float64, float64)
    L_0056: nop
    L_0057: ldloc.1
    L_0058: ldloc.2
    L_0059: newobj instance void [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Line::.ctor(valuetype [acdbmgd]Autodesk.AutoCAD.Geometry.Point3d, valuetype [acdbmgd]Autodesk.AutoCAD.Geometry.Point3d)
    L_005e: stloc.3
    L_005f: ldloc.0
    L_0060: callvirt instance class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.TransactionManager [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Database::get_TransactionManager()
    L_0065: callvirt instance class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Transaction [acdbmgd]Autodesk.AutoCAD.DatabaseServices.TransactionManager::StartTransaction()
    L_006a: stloc.s tr
    L_006c: nop
    L_006d: ldloc.s tr
    L_006f: ldloc.0
    L_0070: callvirt instance valuetype [acdbmgd]Autodesk.AutoCAD.DatabaseServices.ObjectId [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Database::get_BlockTableId()
    L_0075: ldc.i4.0
    L_0076: callvirt instance class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.DBObject [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Transaction::GetObject(valuetype [acdbmgd]Autodesk.AutoCAD.DatabaseServices.ObjectId, valuetype [acdbmgd]Autodesk.AutoCAD.DatabaseServices.OpenMode)
    L_007b: isinst [acdbmgd]Autodesk.AutoCAD.DatabaseServices.BlockTable
    L_0080: stloc.s bt
    L_0082: ldloc.s tr
    L_0084: ldloc.s bt
    L_0086: ldsfld string modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst) [acdbmgd]Autodesk.AutoCAD.DatabaseServices.BlockTableRecord::ModelSpace
    L_008b: callvirt instance valuetype [acdbmgd]Autodesk.AutoCAD.DatabaseServices.ObjectId [acdbmgd]Autodesk.AutoCAD.DatabaseServices.SymbolTable::get_Item(string)
    L_0090: ldc.i4.1
    L_0091: callvirt instance class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.DBObject [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Transaction::GetObject(valuetype [acdbmgd]Autodesk.AutoCAD.DatabaseServices.ObjectId, valuetype [acdbmgd]Autodesk.AutoCAD.DatabaseServices.OpenMode)
    L_0096: isinst [acdbmgd]Autodesk.AutoCAD.DatabaseServices.BlockTableRecord
    L_009b: stloc.s btrMS
    L_009d: ldloc.s btrMS
    L_009f: ldloc.3
    L_00a0: callvirt instance valuetype [acdbmgd]Autodesk.AutoCAD.DatabaseServices.ObjectId [acdbmgd]Autodesk.AutoCAD.DatabaseServices.BlockTableRecord::AppendEntity(class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Entity)
    L_00a5: pop
    L_00a6: ldloc.s tr
    L_00a8: ldloc.3
    L_00a9: ldc.i4.1
    L_00aa: callvirt instance void [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Transaction::AddNewlyCreatedDBObject(class [acdbmgd]Autodesk.AutoCAD.DatabaseServices.DBObject, bool)
    L_00af: nop
    L_00b0: ldloc.s tr
    L_00b2: callvirt instance void [acdbmgd]Autodesk.AutoCAD.DatabaseServices.Transaction::Commit()
    L_00b7: nop
    L_00b8: nop
    L_00b9: leave.s L_00cf
    L_00bb: ldloc.s tr
    L_00bd: ldnull
    L_00be: ceq
    L_00c0: stloc.s CS$4$0000
    L_00c2: ldloc.s CS$4$0000
    L_00c4: brtrue.s L_00ce
    L_00c6: ldloc.s tr
    L_00c8: callvirt instance void [mscorlib]System.IDisposable::Dispose()
    L_00cd: nop
    L_00ce: endfinally
    L_00cf: nop
    L_00d0: ret
    .try L_006c to L_00bb finally handler L_00bb to L_00cf
}

The transaction is disposed here   
L_00c6: ldloc.s tr   
L_00c8: callvirt instance void [mscorlib]System.IDisposable::Dispose()
L_00cd: nop

Pages: [1]