.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Detect if a drawing was OPENED?

6 REPLIES 6
Reply
Message 1 of 7
rmduser
558 Views, 6 Replies

Detect if a drawing was OPENED?

Hi, there!

I have a specific problem regarding the DocumentCreated reactor, that is, I need to distinguish between a drawing being NEWLY CREATED or OPENED. Is there any indication for either case?
After a lot of trying and searching, I'm quite desparate by now 😞

Is there a sensible way for accomplishing this using DocumentCreated? Did I overlook any possibilities?

Thanks for any help!
Greetings,
AlfredG
6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: rmduser

I know if lisp we would look at the system variable 'dwgtitled'. If it
returned 0, then it is a new drawing.

--

Tim
"A blind man lets nothing block his vision."


wrote in message news:5516699@discussion.autodesk.com...
Hi, there!

I have a specific problem regarding the DocumentCreated reactor, that is, I
need to distinguish between a drawing being NEWLY CREATED or OPENED. Is
there any indication for either case?
After a lot of trying and searching, I'm quite desparate by now 😞

Is there a sensible way for accomplishing this using DocumentCreated? Did I
overlook any possibilities?

Thanks for any help!
Greetings,
AlfredG
Message 3 of 7
Anonymous
in reply to: rmduser

If the OriginalFilename property of the Database
ends with .DWT or is an empty string, that should
indicate it is a new document.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5516699@discussion.autodesk.com...
Hi, there!

I have a specific problem regarding the DocumentCreated reactor, that is, I need to distinguish between a drawing being NEWLY CREATED or OPENED. Is there any indication for either case?
After a lot of trying and searching, I'm quite desparate by now 😞

Is there a sensible way for accomplishing this using DocumentCreated? Did I overlook any possibilities?

Thanks for any help!
Greetings,
AlfredG
Message 4 of 7
Anonymous
in reply to: rmduser

You can use a dwg as a template, can not assume the ending to be "dwt" for
new drawings.


/Matt




"Tony Tanzillo" wrote in message
news:5516776@discussion.autodesk.com...
If the OriginalFilename property of the Database
ends with .DWT or is an empty string, that should
indicate it is a new document.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5516699@discussion.autodesk.com...
Hi, there!

I have a specific problem regarding the DocumentCreated reactor, that is, I
need to distinguish between a drawing being NEWLY CREATED or OPENED. Is
there any indication for either case?
After a lot of trying and searching, I'm quite desparate by now 😞

Is there a sensible way for accomplishing this using DocumentCreated? Did I
overlook any possibilities?

Thanks for any help!
Greetings,
AlfredG
Message 5 of 7
Anonymous
in reply to: rmduser

Yea, but that doesn't matter if you use
this (even simpler) test:

bool IsNewDrawing(Document doc)
{
return doc.Name == doc.Database.Filename;
}

Only in a new, unsaved drawing should these
two properties have different values.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Matt" wrote in message news:5517603@discussion.autodesk.com...
You can use a dwg as a template, can not assume the ending to be "dwt" for
new drawings.


/Matt




"Tony Tanzillo" wrote in message
news:5516776@discussion.autodesk.com...
If the OriginalFilename property of the Database
ends with .DWT or is an empty string, that should
indicate it is a new document.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5516699@discussion.autodesk.com...
Hi, there!

I have a specific problem regarding the DocumentCreated reactor, that is, I
need to distinguish between a drawing being NEWLY CREATED or OPENED. Is
there any indication for either case?
After a lot of trying and searching, I'm quite desparate by now 😞

Is there a sensible way for accomplishing this using DocumentCreated? Did I
overlook any possibilities?

Thanks for any help!
Greetings,
AlfredG
Message 6 of 7
rmduser
in reply to: rmduser

Pretty cool: I was just thinking about the problem and came up with a similar idea myself, just seconds before getting notified about your last reply. In my case, I was trying to compare the "FileName" and "OriginalFileName" properties of the Database, which would NOT work.

However, YOUR suggestion seems to do the job!
Thanks a lot, you really saved my day! 🙂

Cheers,
Al
Message 7 of 7
Anonymous
in reply to: rmduser

Oops, the == should be !=

public bool IsNewDrawing(Document doc)
{
return doc.Name != doc.Database.Filename;
}

-
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Tony Tanzillo" wrote in message news:5517635@discussion.autodesk.com...
Yea, but that doesn't matter if you use
this (even simpler) test:

bool IsNewDrawing(Document doc)
{
return doc.Name == doc.Database.Filename;
}

Only in a new, unsaved drawing should these
two properties have different values.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

"Matt" wrote in message news:5517603@discussion.autodesk.com...
You can use a dwg as a template, can not assume the ending to be "dwt" for
new drawings.


/Matt




"Tony Tanzillo" wrote in message
news:5516776@discussion.autodesk.com...
If the OriginalFilename property of the Database
ends with .DWT or is an empty string, that should
indicate it is a new document.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5516699@discussion.autodesk.com...
Hi, there!

I have a specific problem regarding the DocumentCreated reactor, that is, I
need to distinguish between a drawing being NEWLY CREATED or OPENED. Is
there any indication for either case?
After a lot of trying and searching, I'm quite desparate by now 😞

Is there a sensible way for accomplishing this using DocumentCreated? Did I
overlook any possibilities?

Thanks for any help!
Greetings,
AlfredG

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost