Jump to content

Reading the Insbase of a Block Definition drawing using ObjectDBX


ColinHolloway

Recommended Posts

Hi All

 

Sorry this is a re-post. I couldn't work out how to move a post to the correct area.

 

I need to read the Insbase value of an unopened drawing using ObjectDBX. I have already written code that can extract attributes and re-path xref's so the method of opening the drawing database is known. What I need to know is the property name of the Base or Insbase in Modelspace of a drawing.

 

I have opened the drawing database as variable dbxdoc and using (vlax-dump-object (vla-get-ModelSpace dbxdoc)) I get:

 

; IAcadModelSpace: A special Block object containing all model space entities

; Property values:

; Application (RO) = Exception occurred

; BlockScaling = 0

; Comments = ""

; Count (RO) = 96

; Document (RO) = #

; Explodable = -1

; Handle (RO) = "2"

; HasExtensionDictionary (RO) = -1

; IsDynamicBlock (RO) = 0

; IsLayout (RO) = -1

; IsXRef (RO) = 0

; Layout (RO) = #

; Name = "*MODEL_SPACE"

; ObjectID (RO) = 55

; ObjectID32 (RO) = 55

; ObjectName (RO) = "AcDbBlockTableRecord"

; Origin = (0.0 0.0 0.0)

; OwnerID (RO) = 56

; OwnerID32 (RO) = 56

; Path = AutoCAD.Application: Not applicable

; Units = 0

; XRefDatabase (RO) = AutoCAD.Application: No database

 

The property Origin is NOT the base for this drawing as the insbase is:

Command: insbase

Enter new value for INSBASE :

 

The value for insbase must be accessable in the database somewhere but it is eluding me at this time.

 

Thanks in advance for any responses,

 

Colin

Link to comment
Share on other sites

The only thing that comes to mind is:

 

(vla-getvariable <VLA Document Object> "INSBASE")

However, the getvariable / setvariable methods are not exposed to an ObjectDBX Document Object.

Link to comment
Share on other sites

Hi Lee,

 

Thanks for your reply. I was hoping that it was you that responded, even though this time you were a bearer of bad news.

 

Based on your reply I got creative and found a way of getting the INSBASE value I needed! Here is a snippet of my solution:

 

empty is name of drawing template

DwgName is name of xref drawing

inspt is INSBASE value for DwgName

 

 
   (if (/= DwgName (vla-get-fullname doc))
        (setq
            dbxDoc (vla-GetInterfaceObject app "ObjectDBX.AxDbDocument.18")
            dbxopen (vl-catch-all-apply 'vla-open (list dbxDoc empty))
        ) ; end setq
   ) ; end if
   (if (vl-catch-all-error-p dbxopen)
        (setq dbxDoc nil)
   )
   (if (not (= dbxDoc nil))
        (progn
            (vla-attachexternalreference (vla-get-modelspace dbxDoc) DwgName
            (vl-filename-base DwgName) (vlax-3d-point (list 0 0 0)) 1. 1. 1. 0. :vlax-true
        )
        (setq BLKS (vla-get-blocks dbxdoc))
        (vlax-for ENT BLKS
             (if (= (vla-get-isxref ENT) :vlax-true)
                 (progn
                  (setq inspt (vlax-safearray->list (vlax-variant-value (vla-get-origin ENT))) )
                 ) ; end progn
             ) ; end if
        ) ; end vlax-for
        (vlax-release-object BLKS)
        (vlax-release-object dbxDoc)
        ) ; end progn
   ) ; end if

Link to comment
Share on other sites

Nice idea Colin - I've never tried attaching an XRef to a ObjectDBX Document (I didn't think it would work since XRefs are not loaded in Drawings opened with ObjectDBX), but if that indeed works, that's great :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...