Detect if a drawing was OPENED?

Detect if a drawing was OPENED?

rmduser
Contributor Contributor
718 Views
6 Replies
Message 1 of 7

Detect if a drawing was OPENED?

rmduser
Contributor
Contributor
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
0 Likes
719 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
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
0 Likes
Message 3 of 7

Anonymous
Not applicable
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
0 Likes
Message 4 of 7

Anonymous
Not applicable
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
0 Likes
Message 5 of 7

Anonymous
Not applicable
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
0 Likes
Message 6 of 7

rmduser
Contributor
Contributor
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
0 Likes
Message 7 of 7

Anonymous
Not applicable
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
0 Likes