ObjectDbx : Xref Detach kaput
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
ObjectDbx : Xref Detach kaput

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
Michael Puckett
Guest





Posted: Tue Jan 11, 2005 11:24 pm    Post subject: ObjectDbx : Xref Detach kaput Reply with quote

I have not been able to successfully detach xrefs
via ObjectDbx, yet the method is plainly exposed
in the ObjectDbx object model.

Can anyone else verify that the Detach method does
not work via ObjectDbx?

When I attempt to invoke the detach method it throws
a descriptionless Automation error:

"Automation Error. Description was not provided."

My assumption is that despite the method being exposed
it cannot be invoked because the ObjectDbx authors
ran out of coffee.

--
In the beginning the Universe was created. This has
made a lot of people very angry and been widely
regarded as a bad move. Douglas Adams.

Back to top
Owen Wengerd
Guest





Posted: Tue Jan 11, 2005 11:35 pm    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Michael:

Quote:
Can anyone else verify that the Detach method does
not work via ObjectDbx?

I've used it successfully on the current working drawing. Make sure you
delete any AcDbBlockReference objects that reference the xref block before
you attempt to detach it. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
Back to top
Michael Puckett
Guest





Posted: Tue Jan 11, 2005 11:44 pm    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Thank you for responding Owen.

I had tried to delete the actual instances but it had
chucked a wobbly on that too. But I will try again just
to double check.

Just to be clear, I'm using ObjectDBX on documents that
are _NOT_ active in the editor.

Can you use ObjectDBX on documents already opened (like
the active document)? In my experience ObjectDBX refuses
to open documents already open. If I'm doing query only
stuff I'll work off a temp copy, but otherwise one is hooped;
again, this has been my experience this far.

Thanks again Owen.

Cheers.

"Owen Wengerd" <owenw@manusoft.com> wrote in message news:41e41c79$1_1@newsprd01...
Quote:
Michael:

Can anyone else verify that the Detach method does
not work via ObjectDbx?

I've used it successfully on the current working drawing. Make sure you
delete any AcDbBlockReference objects that reference the xref block before
you attempt to detach it. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com



Back to top
Jason Piercey
Guest





Posted: Wed Jan 12, 2005 12:04 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

I've read, in this newsgroup, that external references
are not loaded in a drawing that is accessed via dbx.

I suppose that if an xref hasn't been loaded then it can't
be detached.

--
Autodesk Discussion Group Facilitator



"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e419b7_3@newsprd01...
Quote:
I have not been able to successfully detach xrefs
via ObjectDbx, yet the method is plainly exposed
in the ObjectDbx object model.

Can anyone else verify that the Detach method does
not work via ObjectDbx?

When I attempt to invoke the detach method it throws
a descriptionless Automation error:

"Automation Error. Description was not provided."

My assumption is that despite the method being exposed
it cannot be invoked because the ObjectDbx authors
ran out of coffee.

--
In the beginning the Universe was created. This has
made a lot of people very angry and been widely
regarded as a bad move. Douglas Adams.

Back to top
Jeff Mishler
Guest





Posted: Wed Jan 12, 2005 12:07 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Michael, although it inherits a "Detach" method all you need do is delete
all instances of the Xref's inserts and the next time the drawing is opened
this displays:

Opening an AutoCAD 2000 format file.

Xref "Utils-Dec-04": C:\Land Projects 3\2004\24118 - Stony Village
South\dwg\Utils-Dec-04.dwg
"Utils-Dec-04" is unreferenced and has been purged.
Regenerating model.

Here's the code I tested with:
Sub test_Xref_detach()
Dim doc As AxDbDocument
Dim obj As AcadEntity
Dim xref As AcadExternalReference

Set doc = GetInterfaceObject("ObjectDBX.AxDbDocument")
doc.Open ("c:\test2000.dwg")
For Each obj In doc.ModelSpace
If TypeOf obj Is AcadExternalReference Then
Set xref = obj
xref.Delete
End If
Next
doc.SaveAs ("c:\test2000.dwg")
Set doc = Nothing
End Sub

--
Jeff
check out www.cadvault.com

"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e41e9a$1_3@newsprd01...
Quote:
Thank you for responding Owen.

I had tried to delete the actual instances but it had
chucked a wobbly on that too. But I will try again just
to double check.

Just to be clear, I'm using ObjectDBX on documents that
are _NOT_ active in the editor.

Can you use ObjectDBX on documents already opened (like
the active document)? In my experience ObjectDBX refuses
to open documents already open. If I'm doing query only
stuff I'll work off a temp copy, but otherwise one is hooped;
again, this has been my experience this far.

Thanks again Owen.

Cheers.

"Owen Wengerd" <owenw@manusoft.com> wrote in message
news:41e41c79$1_1@newsprd01...
Michael:

Can anyone else verify that the Detach method does
not work via ObjectDbx?

I've used it successfully on the current working drawing. Make sure
you
delete any AcDbBlockReference objects that reference the xref block
before
you attempt to detach it. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com



Back to top
Michael Puckett
Guest





Posted: Wed Jan 12, 2005 12:22 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Indeed.

I don't know what was with my original attempt to
delete the xref instances, but I was able to blow
them away just now (my test model may have had locked
layers, note to self: unlock / restore prior to mods).
Subsequent opening of doc sported the purging messages
you noted. A PurgeAll prior to saving may usurp said
message. This works well enough for me.

Thanks Jeff.

(And Owen and Jason).

"Jeff Mishler" <jeff_m@cadvault.com> wrote in message news:41e423f7$1_3@newsprd01...
Quote:
Michael, although it inherits a "Detach" method all you need do is delete
all instances of the Xref's inserts and the next time the drawing is opened
this displays:

Opening an AutoCAD 2000 format file.

Xref "Utils-Dec-04": C:\Land Projects 3\2004\24118 - Stony Village
South\dwg\Utils-Dec-04.dwg
"Utils-Dec-04" is unreferenced and has been purged.
Regenerating model.

Here's the code I tested with:
Sub test_Xref_detach()
Dim doc As AxDbDocument
Dim obj As AcadEntity
Dim xref As AcadExternalReference

Set doc = GetInterfaceObject("ObjectDBX.AxDbDocument")
doc.Open ("c:\test2000.dwg")
For Each obj In doc.ModelSpace
If TypeOf obj Is AcadExternalReference Then
Set xref = obj
xref.Delete
End If
Next
doc.SaveAs ("c:\test2000.dwg")
Set doc = Nothing
End Sub

--
Jeff
check out www.cadvault.com

"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e41e9a$1_3@newsprd01...
Thank you for responding Owen.

I had tried to delete the actual instances but it had
chucked a wobbly on that too. But I will try again just
to double check.

Just to be clear, I'm using ObjectDBX on documents that
are _NOT_ active in the editor.

Can you use ObjectDBX on documents already opened (like
the active document)? In my experience ObjectDBX refuses
to open documents already open. If I'm doing query only
stuff I'll work off a temp copy, but otherwise one is hooped;
again, this has been my experience this far.

Thanks again Owen.

Cheers.

"Owen Wengerd" <owenw@manusoft.com> wrote in message
news:41e41c79$1_1@newsprd01...
Michael:

Can anyone else verify that the Detach method does
not work via ObjectDbx?

I've used it successfully on the current working drawing. Make sure
you
delete any AcDbBlockReference objects that reference the xref block
before
you attempt to detach it. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com





Back to top
Michael Puckett
Guest





Posted: Wed Jan 12, 2005 12:25 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Note to self: PurgeAll not available in ObjectDBX.

:)

"Michael Puckett" <Sp@mYourself.Sucka> wrote in message news:41e42762_1@newsprd01...
Quote:
Indeed.

I don't know what was with my original attempt to
delete the xref instances, but I was able to blow
them away just now (my test model may have had locked
layers, note to self: unlock / restore prior to mods).
Subsequent opening of doc sported the purging messages
you noted. A PurgeAll prior to saving may usurp said
message. This works well enough for me.

Thanks Jeff.

(And Owen and Jason).

"Jeff Mishler" <jeff_m@cadvault.com> wrote in message news:41e423f7$1_3@newsprd01...
Michael, although it inherits a "Detach" method all you need do is delete
all instances of the Xref's inserts and the next time the drawing is opened
this displays:

Opening an AutoCAD 2000 format file.

Xref "Utils-Dec-04": C:\Land Projects 3\2004\24118 - Stony Village
South\dwg\Utils-Dec-04.dwg
"Utils-Dec-04" is unreferenced and has been purged.
Regenerating model.

Here's the code I tested with:
Sub test_Xref_detach()
Dim doc As AxDbDocument
Dim obj As AcadEntity
Dim xref As AcadExternalReference

Set doc = GetInterfaceObject("ObjectDBX.AxDbDocument")
doc.Open ("c:\test2000.dwg")
For Each obj In doc.ModelSpace
If TypeOf obj Is AcadExternalReference Then
Set xref = obj
xref.Delete
End If
Next
doc.SaveAs ("c:\test2000.dwg")
Set doc = Nothing
End Sub

--
Jeff
check out www.cadvault.com

"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e41e9a$1_3@newsprd01...
Thank you for responding Owen.

I had tried to delete the actual instances but it had
chucked a wobbly on that too. But I will try again just
to double check.

Just to be clear, I'm using ObjectDBX on documents that
are _NOT_ active in the editor.

Can you use ObjectDBX on documents already opened (like
the active document)? In my experience ObjectDBX refuses
to open documents already open. If I'm doing query only
stuff I'll work off a temp copy, but otherwise one is hooped;
again, this has been my experience this far.

Thanks again Owen.

Cheers.

"Owen Wengerd" <owenw@manusoft.com> wrote in message
news:41e41c79$1_1@newsprd01...
Michael:

Can anyone else verify that the Detach method does
not work via ObjectDbx?

I've used it successfully on the current working drawing. Make sure
you
delete any AcDbBlockReference objects that reference the xref block
before
you attempt to detach it. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com







Back to top
Michael Puckett
Guest





Posted: Wed Jan 12, 2005 2:37 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Just a quick follow up / heads up note --

If you are using the CleanRegApp.exe or
CleanRegApp-2005.exe utilities (per thread 2004/12/09
4:19PM -- "Fastest APP ID and layer filter purger
available to everyone now!") to purge drawings with
cancerous RegApp entries

(see http://autodesk.blogs.com/between_the_lines/2004/12/layer_filter_an.html)

AND

you plan on Detaching XREFS via the 'Delete method as
discussed in this thread ...

.... hit the drawings with the CleanRegApp.exe first.

If you delete the XREF instances and then try to use the
CleanRegApp.exe utility it will go fatal (corrupting the
drawing in the process). It's fine the other way round.

<Based on nominal testing>
Back to top
Jeff Mishler
Guest





Posted: Wed Jan 12, 2005 2:44 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Very interesting.......thanks for being the guinea pig on that one ;-)

--
Jeff
check out www.cadvault.com
"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e44715$1_3@newsprd01...
Quote:
Just a quick follow up / heads up note --

If you are using the CleanRegApp.exe or
CleanRegApp-2005.exe utilities (per thread 2004/12/09
Back to top
Rudy Tovar
Guest





Posted: Wed Jan 12, 2005 2:52 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Delete the object...

Oh, and I had read in the Visual LISP Bible that you could open a document
that was already opened by someone else, just that you couldn't open it if
they were running the same dbx function you were, or something to that
likeness...

I've purged or should I say deleted layers, and blocks...using dbx...



"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e42807$1_3@newsprd01...
Quote:
Note to self: PurgeAll not available in ObjectDBX.

:)

"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e42762_1@newsprd01...
Indeed.

I don't know what was with my original attempt to
delete the xref instances, but I was able to blow
them away just now (my test model may have had locked
layers, note to self: unlock / restore prior to mods).
Subsequent opening of doc sported the purging messages
you noted. A PurgeAll prior to saving may usurp said
message. This works well enough for me.

Thanks Jeff.

(And Owen and Jason).

"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:41e423f7$1_3@newsprd01...
Michael, although it inherits a "Detach" method all you need do is
delete
all instances of the Xref's inserts and the next time the drawing is
opened
this displays:

Opening an AutoCAD 2000 format file.

Xref "Utils-Dec-04": C:\Land Projects 3\2004\24118 - Stony Village
South\dwg\Utils-Dec-04.dwg
"Utils-Dec-04" is unreferenced and has been purged.
Regenerating model.

Here's the code I tested with:
Sub test_Xref_detach()
Dim doc As AxDbDocument
Dim obj As AcadEntity
Dim xref As AcadExternalReference

Set doc = GetInterfaceObject("ObjectDBX.AxDbDocument")
doc.Open ("c:\test2000.dwg")
For Each obj In doc.ModelSpace
If TypeOf obj Is AcadExternalReference Then
Set xref = obj
xref.Delete
End If
Next
doc.SaveAs ("c:\test2000.dwg")
Set doc = Nothing
End Sub

--
Jeff
check out www.cadvault.com

"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e41e9a$1_3@newsprd01...
Thank you for responding Owen.

I had tried to delete the actual instances but it had
chucked a wobbly on that too. But I will try again just
to double check.

Just to be clear, I'm using ObjectDBX on documents that
are _NOT_ active in the editor.

Can you use ObjectDBX on documents already opened (like
the active document)? In my experience ObjectDBX refuses
to open documents already open. If I'm doing query only
stuff I'll work off a temp copy, but otherwise one is hooped;
again, this has been my experience this far.

Thanks again Owen.

Cheers.

"Owen Wengerd" <owenw@manusoft.com> wrote in message
news:41e41c79$1_1@newsprd01...
Michael:

Can anyone else verify that the Detach method does
not work via ObjectDbx?

I've used it successfully on the current working drawing. Make
sure
you
delete any AcDbBlockReference objects that reference the xref block
before
you attempt to detach it. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com









Back to top
Michael Puckett
Guest





Posted: Wed Jan 12, 2005 3:39 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

<musing out loud>

Based purely on speculation / linear logic, there's
a good chance said utilities will toss a wobbly when
an xref entry exists without at least one instance,
i.e. deleted by a user, not necessarily from code.
While bad practice this happens. :(

Maybe the util looks to an instance of an xref to find
the path for the xref so if it can determine if said
xref is responsible for some of the appids (this is
frequently the case).

Or not.

Maybe it'll hurl ones and zeros on blocks defs without
instances too.

If I weren't so busy I'd check these scenarios out;
perhaps down the road.

</musing out loud>

"Jeff Mishler" <jeff_m@cadvault.com> wrote in message news:41e448cc$1_1@newsprd01...
Quote:
Very interesting.......thanks for being the guinea pig on that one ;-)

--
Jeff
check out www.cadvault.com
"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e44715$1_3@newsprd01...
Just a quick follow up / heads up note --

If you are using the CleanRegApp.exe or
CleanRegApp-2005.exe utilities (per thread 2004/12/09

Back to top
LUCAS
Guest





Posted: Wed Jan 12, 2005 9:21 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

;;Source is a valid path & dwg name
;;(DBX (getfiled "\ns\Select dwg file: " (getvar "dwgprefix") "dwg" 8))
;;By (LUCAS)
;;Code only work for one xref, not for nested xref....
;;Solution for nested xref¡K¡Kneed help!
(defun DBX (SOURCE / APP ODOC DOC ODBX DOCTEST FILENAME)

(vl-load-com)

(setq APP (vlax-get-acad-object)
DOC (vla-get-activedocument APP)
)

(vlax-for ODOC (vla-get-documents APP)
(if (= (strcase (vla-get-fullname ODOC)) (strcase SOURCE))
(setq DOCTEST t)
)
)

(if (and (not DOCTEST) (setq FILENAME (findfile SOURCE)))
(progn
(if (> (atoi (getvar "AcadVer")) 15)
(setq ODBX (vla-getinterfaceobject
APP
"ObjectDBX.AxDbDocument.16"
)
)
(progn
(if (not (vl-registry-read
"HKEY_CLASSES_ROOT\\ObjectDBX.AxDbDocument\\CLSID"
)
)
(startapp "regsvr32.exe"
(strcat "/s \"" (findfile "axdb15.dll") "\"")
)
)
(setq ODBX (vla-getinterfaceobject
APP
"ObjectDBX.AxDbDocument"
)
)
)
)
(vla-open ODBX FILENAME)
(TT ODBX)
(DBXSAVE ODBX)
(mapcar 'vlax-release-object (list APP DOC ODBX))
)
(progn
(if DOCTEST
(alert
"You tried to use a file in use by Autocad, please close it and try
again...."
)
(alert "Source file not found, please try again....")
)
)
)
(princ)
)

(defun DBXSAVE (DBXDOC)
(vla-saveas DBXDOC (vla-get-name DBXDOC))
)

(defun TT (DOC / BLKS ENT NAME OLDNAME
ENTT PATH ODBX1 LINETYPES OBJLIST
X OBJARRAY
)
(setq BLKS (vla-get-blocks DOC))

(vlax-for ENT BLKS
(if (= (vla-get-isxref ENT) :vlax-true)
(progn
(setq PATH (vla-get-path ENT))
(setq ODBX1 (vla-getinterfaceobject
APP
"ObjectDBX.AxDbDocument.16"
)
)
(vla-open ODBX1 PATH)
(setq LINETYPES (vla-get-linetypes ODBX1))
;;http://discussion.autodesk.com/thread.jspa?messageID=2043584
;;remove then linetypes error
(vlax-for X LINETYPES
(setq OBJLIST (cons X OBJLIST))
)
(setq OBJARRAY (vlax-safearray-fill
(vlax-make-safearray
vlax-vbobject
(cons 0 (1- (length OBJLIST)))
)
OBJLIST
)
)
(vlax-invoke-method
ODBX1
"copyobjects"
OBJARRAY
(vla-get-linetypes DOC)
)
(vlax-release-object LINETYPES)
(vlax-release-object ODBX1)
(vla-put-name
ENT
(setq OLDNAME (strcat (setq NAME (vla-get-name ENT)) "_LAI"))
)
(vla-delete
(vla-insertblock
(vla-get-modelspace DOC)
(vlax-3d-point '(0 0 0))
PATH
1
1
1
0
)
)
)
)
)
(vlax-for ENTT BLKS
(vlax-for ENT ENTT
(if (and (= (vla-get-objectname ENT) "AcDbBlockReference")
(= (vla-get-name ENT) OLDNAME)
)
(vla-put-name ENT NAME)
)
(vla-update ENT)
)
)
(vlax-release-object BLKS)
(princ)
)

"Michael Puckett" <Sp@mYourself.Sucka> ¦b¶l¥ó news:41e4559e$1_3@newsprd01 ¤¤
¼¶¼g...
Quote:
musing out loud

Based purely on speculation / linear logic, there's
a good chance said utilities will toss a wobbly when
an xref entry exists without at least one instance,
i.e. deleted by a user, not necessarily from code.
While bad practice this happens. :(

Maybe the util looks to an instance of an xref to find
the path for the xref so if it can determine if said
xref is responsible for some of the appids (this is
frequently the case).

Or not.

Maybe it'll hurl ones and zeros on blocks defs without
instances too.

If I weren't so busy I'd check these scenarios out;
perhaps down the road.

/musing out loud

"Jeff Mishler" <jeff_m@cadvault.com> wrote in message
news:41e448cc$1_1@newsprd01...
Very interesting.......thanks for being the guinea pig on that one ;-)

--
Jeff
check out www.cadvault.com
"Michael Puckett" <Sp@mYourself.Sucka> wrote in message
news:41e44715$1_3@newsprd01...
Just a quick follow up / heads up note --

If you are using the CleanRegApp.exe or
CleanRegApp-2005.exe utilities (per thread 2004/12/09



Back to top
Tony Tanzillo
Guest





Posted: Wed Jan 12, 2005 10:03 am    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

"Jason Piercey" <Jason AT atreng DOT com> wrote

Quote:
I've read, in this newsgroup, that external references
are not loaded in a drawing that is accessed via dbx.

I suppose that if an xref hasn't been loaded then it can't
be detached.

That was the case in R15. When you accessed the Blocks
collection, XRef blocks were not included (e.g., they were
not in the collection at all).

However, given that XREF operations were moved from
the drawing editor to the databaase realm in R16, this
probably has changed.

I also don't know how this relates to VISRETAIN'd XREF
layers, but since they are dependent on Xrefs, that might
also need to be considered.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com
Back to top
Jason Piercey
Guest





Posted: Wed Jan 12, 2005 7:15 pm    Post subject: Re: ObjectDbx : Xref Detach kaput Reply with quote

Thanks for the additional information.

--
Autodesk Discussion Group Facilitator



"Tony Tanzillo" <tony.tanzillo@U_KNOW_WHERE.com> wrote in message
news:41e4eb2f$1_2@newsprd01...

Quote:
That was the case in R15. When you accessed the Blocks
collection, XRef blocks were not included (e.g., they were
not in the collection at all).

However, given that XREF operations were moved from
the drawing editor to the databaase realm in R16, this
probably has changed.

I also don't know how this relates to VISRETAIN'd XREF
layers, but since they are dependent on Xrefs, that might
also need to be considered.

--
http://www.caddzone.com

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

Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Contact Us
Powered by phpBB