Author Topic: .NET Documentation questions.  (Read 13169 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: .NET Documentation questions.
« Reply #30 on: December 07, 2015, 10:21:31 PM »
For Kean, or the assigned tech :
Has this ever been done.
If so, Where ?

Just to follow up on this... the docs do indeed need to be fixed. You can rely on Editor.Command() completing commands for you rather than cancelling them: so you should only need a while loop if you need finer-grained control over the command tokens.

Kean
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kean

  • Newt
  • Posts: 48
Re: .NET Documentation questions.
« Reply #31 on: December 08, 2015, 05:12:31 AM »
For Kean, or the assigned tech :
Has this ever been done.
If so, Where ?

I just checked and it doesn't appear to have made it into the shipping docs (not surprisingly - this thread came up after the SDK docs had already shipped for 2016). I've reminded the docs team.

I've also just received this notification, in case it's of interest (I see that CAD Standards was mentioned, earlier in the thread):

>>>
CAD Standards Plug-in and Transmittal Object library docs have been released and now have .NET sample code.
 
CAD Standards Plug-in library
http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-F126AABA-FE9E-4E26-B51D-88D3E54512B5
 
Transmittal Object library
http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-667D1179-3A76-437E-BBB7-12ADF3E614F7
<<<

More is in the works, it seems. You might want to check Lee Ambrosius's AU class, once it gets posted. It previews more of what's coming:

>>>
IT10489 - Harnessing the Power of the AutoCAD COM APIs
https://events.au.autodesk.com/connect/sessionDetail.ww?SESSION_ID=10489
 
The session also covers the use of the Database Connectivity Automation Object and Sheet Set Object libraries which also will have full sample projects.
<<<

Kean

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: .NET Documentation questions.
« Reply #32 on: December 08, 2015, 05:19:00 AM »

Thanks Kean.

Is it worth pointing to this thread with a blog article ?

The more input we get the better. There is a certain amount we take for granted after playing with the API for 10 years ... beginners don't have that 'luxury'.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jeff H

  • Needs a day job
  • Posts: 6144
Re: .NET Documentation questions.
« Reply #33 on: December 09, 2015, 05:10:47 AM »
Advice regarding the use of Transactions is contradictory.

Refer the ..\ObjectARX 2016\Samples\dotNet\ files

Typically the Tables are instantiated using the GetObject method of the TransactionManager.
The AddNewlyCreatedDBObject method variously uses the Transaction and the TransactionManager
Advice and examples elsewhere use the methods of the Transaction, which I understand is correct.

Why are they different ?
No matter which one used they end up calling the same methods but for many calls it might matter which one used for AddNewlyCreatedDBObject.
Maybe better stated as how it is accessed as shown below.

For ObjectARX the GetObject and AddNewlyCreatedDBObject methods are duplicated in TransactionManager and uses last transaction added(TopTransaction) to call Getobject() and AddNewlyCreatedDBObject.
Since GetObject and AddNewlyCreatedDBObject can only be used by the last transaction added the TransactionManager will always use the correct Transaction to call both methods , and do not have to keep up with a instance to pass between methods.

The way it is implemented in .NET is Transaction and TransactionManager GetObject call a static method defined in TransactionManager which calls GetObject of the last Transaction

Transaction GetObject
Code - C#: [Select]
  1.         public virtual unsafe DBObject GetObject(.....)
  2.         {
  3.             this.CheckTopTransaction();
  4.             return Autodesk.AutoCAD.DatabaseServices.TransactionManager.GetObjectInternal(.....);
  5.         }
  6.  

So Transaction.GetObject calls TransactionManager.GetObjectInternal to call back to its unmanged Getobject (), so it does not matter which one and will
end up calling the same methods.

The same goes for AddNewlyCreatedDBObject but how you access it could make a difference when used many times in loop.

Transaction's AddNewlyCreatedDBObject
Code - C#: [Select]
  1.         public virtual void AddNewlyCreatedDBObject(DBObject obj, [MarshalAs(UnmanagedType.U1)] bool add)
  2.         {
  3.             this.TransactionManager.AddNewlyCreatedDBObject(obj, add);
  4.         }
  5.  

AddNewlyCreatedDBObject does not use a static method and uses a instance of TransactionManger.
The Transaction's property named TransactionManager of type TransactionManager is used to call TransactionManager.AddNewlyCreatedDBObject.

But Look at Transaction's property for TransactionManager
Code - C#: [Select]
  1.         public virtual Autodesk.AutoCAD.DatabaseServices.TransactionManager TransactionManager
  2.         {
  3.             get
  4.             {
  5.                 IntPtr unmanagedPointer = new IntPtr(AcDbImpTransaction.transactionManager((AcDbImpTransaction* modopt(IsConst) modopt(IsConst)) this.GetImpObj()));
  6.                 return (Autodesk.AutoCAD.DatabaseServices.TransactionManager) RXObject.Create(unmanagedPointer, false);
  7.             }
  8.         }
  9.  

Notice how the property getter creates a new manged wrapper each time it is called(return ...RXObject.Create(unmanagedPointer, false))

So for adding many objects it might be best to create a variable to use same TransactionManager.

Jeff H

  • Needs a day job
  • Posts: 6144
Re: .NET Documentation questions.
« Reply #34 on: December 09, 2015, 05:20:06 AM »
Determining or making Table Records.
Invariably there is no advice to make allowance for Records that have been erased.
Typically the advice is to simply check if the Table Has the record and either return the Id of Add a new Record and return it's Id.
Fundamental information about the API would help I think.

If they explained why they choose the SymbolTable data structure back in the 80's or whenever and how it is implemented(hashtable, linklist, etc...) would provide value.
Maybe then would understand why it does not expose a delete or remove method, etc...
Then things like this would not be a surprise but make sense and expect it instead of having to assume and react.
« Last Edit: December 09, 2015, 05:24:57 AM by Jeff H »

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2111
  • class keyThumper<T>:ILazy<T>
Re: .NET Documentation questions.
« Reply #35 on: January 30, 2016, 08:57:47 PM »
Can we please have a  definitive description of the full technical meaning of the noDocument parameter for the Database constructor.

purpose,
ramifications
side effects
traps

added:
Are there any special considerations regarding Transactions or DocumentLocking associated with either option ??


« Last Edit: January 30, 2016, 09:43:43 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Kean

  • Newt
  • Posts: 48
Re: .NET Documentation questions.
« Reply #36 on: February 01, 2016, 03:55:11 AM »
Can we please have a  definitive description of the full technical meaning of the noDocument parameter for the Database constructor.

purpose,
ramifications
side effects
traps

added:
Are there any special considerations regarding Transactions or DocumentLocking associated with either option ??




I assume you've seen what's in the ObjectARX docs, already:

Quote
bool noDocument = false
Boolean specifying whether or not to associate this database to the current document. When noDocument = true, then the database is standalone, which means the database does not use the documents undo controller, locking, and other services. 

I only ever use side databases independently of documents, myself.

Kean

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2111
  • class keyThumper<T>:ILazy<T>
Re: .NET Documentation questions.
« Reply #37 on: February 01, 2016, 04:11:38 AM »

Hi Kean,
This particular issue started here
http://forums.autodesk.com/t5/net/about-insert-a-block-to-a-new-database/m-p/5988683#U5988683

I went looking for a self contained answer and was only able to provide breadcrumbs.
I'm pretty sure I have a rough idea of the ramifications, but I'm not comfortable with the limitations of my understanding.

Yes, most of the information I have comes from the native docs, not the .net.

I sure wish Tony T had written his book.

... in the mean time a web article from someone who knows about the .Net API would be great. Do you know anyone who understands this stuff completely?


Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

Kean

  • Newt
  • Posts: 48
Re: .NET Documentation questions.
« Reply #38 on: February 01, 2016, 06:19:20 AM »
Hi Kerry,

I went looking for instances where we either set this second flag to "Adesk::kFalse" or use the default value. Most were in samples or our test harness. In my opinion it's one of those arguments that was exposed from the AcDbDatabase constructor, back in the day, which isn't of real significance to people. The default value (IMO) should have been "true", given the fact the vast majority of cases set it to this, but it was presumably set this way for a reason, and was then propagated when we implemented the .NET wrapper to it.

I've never set this to false (or accepted the default) and never expect to. I've flagged it (mentally) as such.

Regards,

Kean

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2111
  • class keyThumper<T>:ILazy<T>
Re: .NET Documentation questions.
« Reply #39 on: February 01, 2016, 06:42:22 AM »

I have an old ( ac2008 ) ObjectARX Delevopers Guide book .. before they stopped chopping down trees.

Chapter 4 Database Operations
 --> Initial Database
 --> Creating and populating a Database

was another breadcrumb.

The difficulty with old references is that they CAN get out of date and cause embarrassment.

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.