ColinHolloway Posted February 24, 2012 Share Posted February 24, 2012 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 24, 2012 Share Posted February 24, 2012 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. Quote Link to comment Share on other sites More sharing options...
SLW210 Posted February 24, 2012 Share Posted February 24, 2012 In the future, let a moderator move your original post. Quote Link to comment Share on other sites More sharing options...
ColinHolloway Posted February 27, 2012 Author Share Posted February 27, 2012 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 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 27, 2012 Share Posted February 27, 2012 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 Quote Link to comment Share on other sites More sharing options...
ColinHolloway Posted February 27, 2012 Author Share Posted February 27, 2012 Yeah it works a treat! I like it when you think "what if?" and it rewards you with a solution. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted February 27, 2012 Share Posted February 27, 2012 Yeah it works a treat! I like it when you think "what if?" and it rewards you with a solution. Definitely! The 'what ifs' are definitely worth a punt Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.