Author Topic: ObjectDBX and Attributes  (Read 27216 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #15 on: August 30, 2006, 06:26:46 PM »
Question: When using the code provided, can I pass the database (db) to sub-functions? or do I have to try something else?
Yes. You can pass Database any function (really reference will be passed).
Quote
It looks like it might work, but I get an error when trying the command in Acad.  Here is the main part of the rouine.  If needs be I can post the whole code.
What error message? Are you trying to debug this code? Debugging maybe very usefull.
Attached are the error messages.  I tried to debug it, but it said I didn't have the right JIT version (I think), and then it just hung it up till I used task manager to end it.

Just a quick guess, perhaps a Doclock may be required.
I can try that Mick.  Thanks.  Will let you know...... It didn't work.  Got the same error, but I used it on the current drawing, is that correct?
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #16 on: August 30, 2006, 06:34:59 PM »
How can I add an error function (for lack of better wording) like in Lisp so that I know where, or what is causing it to crash, so that I can debug it better?  I can select the drawings, but after that it crashes.  Thanks again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Alexander Rivilis

  • Bull Frog
  • Posts: 214
  • Programmer from Kyiv (Ukraine)
Re: ObjectDBX and Attributes
« Reply #17 on: August 30, 2006, 06:35:39 PM »
Got the same error, but I used it on the current drawing, is that correct?
IMHO yours code can not work with current drawing (or any other drawing opened in AutoCAD).
If you can not use debugger (I do not know why it is not installed), use any kind of dialog messages in order to localize place of error.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #18 on: August 30, 2006, 06:41:32 PM »
Got the same error, but I used it on the current drawing, is that correct?
IMHO yours code can not work with current drawing (or any other drawing opened in AutoCAD).
If you can not use debugger (I do not know why it is not installed), use any kind of dialog messages in order to localize place of error.
The code runs in the current drawing, I was talking about using the 'DocumentLock' that MickD was talking about.

I can throw in some stuff to see where it errors I guess.  I will post when I know something new.

Thanks again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #19 on: August 30, 2006, 06:54:44 PM »
It has to do with the save.  I will see if I can find anything out on the net.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Glenn R

  • Guest
Re: ObjectDBX and Attributes
« Reply #20 on: August 30, 2006, 07:00:34 PM »
If you're using Database.Save() then it doesn't seem to work.
You will have to use Database.Saveas()...found that out a while ago.

Hope this helps.

Cheers,
Glenn.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #21 on: August 30, 2006, 07:09:34 PM »
If you're using Database.Save() then it doesn't seem to work.
You will have to use Database.Saveas()...found that out a while ago.

Hope this helps.

Cheers,
Glenn.
I was trying to use dbxDoc.Save() and that doesn't seem to work, then I tried dbxDoc.SaveAs (dbxDoc.Name) but I need one more parm, but I'm not sure what to put.  In the ide it says that
Quote
public virtual void SaveAs(
 string FileName,
 object vSecurityParams
)
I then look at the 'SecurityParams' and didn't quite see something I would use.

Needless to say I'm a little lost here.

Thanks again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MickD

  • King Gator
  • Posts: 3619
  • (x-in)->[process]->(y-out) ... simples!
Re: ObjectDBX and Attributes
« Reply #22 on: August 30, 2006, 07:18:31 PM »
In times like these it helps to have a look at the arx api for a bit of guidence.
Quote
To specify security parameters, set pSecurity to point to a SecurityParams struct that conveys your preferences. If pSecurity is non-NULL, its settings override any previous database security settings. If pSecurity is NULL, any currently enforced security settings remain in effect. If no previous security-related settings were specified, and pSecurity is NULL, no security-related operation is attempted. If the SecurityParams struct passed as the pSecurity argument is not properly initialized, the method fails. See SecurityParams for more information on initializing this struct.

So, with that I'd try a 'null' or SystemType.Missing (or what ever it is :) )
"Short cuts make long delays,' argued Pippin.”
J.R.R. Tolkien

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #23 on: August 30, 2006, 07:32:28 PM »
In times like these it helps to have a look at the arx api for a bit of guidence.
Quote
To specify security parameters, set pSecurity to point to a SecurityParams struct that conveys your preferences. If pSecurity is non-NULL, its settings override any previous database security settings. If pSecurity is NULL, any currently enforced security settings remain in effect. If no previous security-related settings were specified, and pSecurity is NULL, no security-related operation is attempted. If the SecurityParams struct passed as the pSecurity argument is not properly initialized, the method fails. See SecurityParams for more information on initializing this struct.

So, with that I'd try a 'null' or SystemType.Missing (or what ever it is :) )
null didn't work, and neither did SystemType.Missing.  I also tried something I found on the adesk ng, but that didn't work either (it was)
Code: [Select]
dbxDoc.SaveAs (dbxDoc.Name, new Autodesk.AutoCAD.DatabaseServices.SecurityParameters());
Then I tried this, because I'm using ObjectDBX
Code: [Select]
dbxDoc.SaveAs (dbxDoc.Name, new Autodesk.AutoCAD.Interop.Common.SecurityParams());
With no luck either.  I added a message box right before the save, and it displays, so I'm sure it's the save.

Thanks for all the effort guys.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Glenn R

  • Guest
Re: ObjectDBX and Attributes
« Reply #24 on: August 30, 2006, 07:50:36 PM »
If you tried SystemType.Missing then that won't work.
It should be System.Type.Missing.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #25 on: August 31, 2006, 11:10:29 AM »
If you tried SystemType.Missing then that won't work.
It should be System.Type.Missing.
Thanks Glenn, but it didn't work either.  It compiled with that, but didn't work.  Still looking.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: ObjectDBX and Attributes
« Reply #26 on: August 31, 2006, 03:12:30 PM »
FileType is the second argument.  SecurityParam is optional. 

File Types are:

ac2000_dwg
 AutoCAD 2000 DWG (*.dwg)
 
ac2000_dxf
 AutoCAD 2000 DXF (*.dxf)
 
ac2000_Template
 AutoCAD 2000 Drawing Template File (*.dwt)
 
ac2004_dwg
 AutoCAD 2004 DWG (*.dwg)
 
ac2004_dxf
 AutoCAD 2004 DXF (*.dxf)
 
ac2004_Template
 AutoCAD 2004 Drawing Template File (*.dwt)
 
acNative
 A synonym for the latest drawing release. In this release, this value equals ac2004_dwg.
 
James Buzbee
Windows 8

T.Willey

  • Needs a day job
  • Posts: 5251
Re: ObjectDBX and Attributes
« Reply #27 on: August 31, 2006, 03:29:04 PM »
How would you use it?  I tried
dbxDoc.SaveAs (dbxDoc.Name, ac2004_dwg);
and it wouldn't complie, so then I tried it as a string, and got the same error.

Man this is frustrating, so close, but can't cross the finish line.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: ObjectDBX and Attributes
« Reply #28 on: August 31, 2006, 03:40:37 PM »

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: ObjectDBX and Attributes
« Reply #29 on: August 31, 2006, 03:45:41 PM »
Sorry for the confusion: ac2004_dwg is the activex constant.  I havn't tried this in .net but as long as your referencing the AxDb1#.dll I would think it should work?  

My only other thought would be the first argument is the name only: "MyDrawing" and the second argument as a string ".dwg" ??? Just purely guessing here . . ..
James Buzbee
Windows 8