TheSwamp

Code Red => .NET => Topic started by: neyton on March 03, 2016, 01:21:19 PM

Title: bricscad 2016 64bits error on create dbpoint
Post by: neyton on March 03, 2016, 01:21:19 PM
Hi,

this code:

...
Code - vb.net: [Select]
  1. Dim pt as new point3d(1,1,1)
  2. Dim pEnt As New DBPoint( pt )
  3. ' add pEnt to model space
  4.  
  5. 'not set Y and Z to pEnt in bricscad 2016 64bits.


to work:

Code - vb.net: [Select]
  1. Dim pt as new point3d(1,1,1)
  2. Dim pEnt As New DBPoint
  3. pEnt.location = pt


why????
Title: Re: bricscad 2016 64bits error on create dbpoint
Post by: owenwengerd on March 03, 2016, 06:15:12 PM
Sounds like a bug. Please submit a support request so someone from Bricsys can have a look and get it fixed.
Title: Re: bricscad 2016 64bits error on create dbpoint
Post by: It's Alive! on March 04, 2016, 08:09:32 PM
works in C#

Code - C#: [Select]
  1. public static class Commands
  2.     {
  3.         [CommandMethod("test")]
  4.         static public void test()
  5.         {
  6.             Database database = HostApplicationServices.WorkingDatabase;
  7.             DBPoint dbpoint = new DBPoint(new Point3d(1, 1, 1));
  8.             AddToModelSpace(database, dbpoint);
  9.         }
  10.  
  11.         public static ObjectIdCollection AddToModelSpace(Database database, params Entity[] list)
  12.         {
  13.             ObjectIdCollection ids = new ObjectIdCollection();
  14.             AcDb.TransactionManager manager = database.TransactionManager;
  15.             using (Transaction action = manager.StartTransaction())
  16.             {
  17.                 BlockTable blockTable =
  18.                     action.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable;
  19.                 if (blockTable == null)
  20.                     throw new System.NullReferenceException("blockTable == null");
  21.  
  22.                 BlockTableRecord blockTableRecord =
  23.                     action.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
  24.                 if (blockTableRecord == null)
  25.                     throw new System.NullReferenceException("blockTableRecord == null");
  26.  
  27.                 foreach (Entity ent in list)
  28.                 {
  29.                     ids.Add(blockTableRecord.AppendEntity(ent));
  30.                     action.AddNewlyCreatedDBObject(ent, true);
  31.                 }
  32.                 action.Commit();
  33.             }
  34.             return ids;
  35.         }
  36.     }
  37.  
Title: Re: bricscad 2016 64bits error on create dbpoint
Post by: kdub on March 04, 2016, 11:23:34 PM

Hi Daniel,

It always makes me feel warm and fuzzy when I see methods like AddToModelSpace()

Does BricsCAD use Extension Methods ?? ( I assume so , as they are implemented through  .NET not the API)

Do you know why the BricsCad sample code used a variable named action for the Transaction instance ??
Title: Re: bricscad 2016 64bits error on create dbpoint
Post by: It's Alive! on March 04, 2016, 11:33:16 PM
Do you know why the BricsCad sample code used a variable named action for the Transaction instance ??

transactionInator was too long
Title: Re: bricscad 2016 64bits error on create dbpoint
Post by: kdub on March 05, 2016, 01:38:26 AM
Do you know why the BricsCad sample code used a variable named action for the Transaction instance ??

transactionInator was too long

Perfectly sensible !!
Title: Re: bricscad 2016 64bits error on create dbpoint
Post by: neyton on March 07, 2016, 09:04:23 AM
You tested this code in bricscad 2016 64 bits?

Title: Re: bricscad 2016 64bits error on create dbpoint
Post by: It's Alive! on March 07, 2016, 07:50:48 PM
You tested this code in bricscad 2016 64 bits?

its a bug! file a request