GithubHelp home page GithubHelp logo

odbx_lib's Introduction

ObjectDBX

ObjectDBX allows you to create your own 'ObjectDBX Host Application' a standalone application that can load and manipulate drawings. ObjectDBX is a subset of ObjectARX and a C++ object‐oriented API for manipulating AutoCAD and its related objects, collections, properties, methods. This is perfect for batch processing of dwgs, especially for looking up information. Editing drawings is trickier because it's limited, using accoreconsole.exe is complementary.

- No access to System Variables (getvar ...)

- No Selection sets (ssget ...)

- No ent fonctions (entmod ...)

- No Application Methodes (vla-zoomextents ...)

The function in Autolisp/Visual-Lisp that retrieves the ObjectDBX :

- Argument: String, The complet path of the dwg.

- Return: a VLA object, drawing object
(defun getaxdbdoc (filename / axdbdoc release)
  (setq axdbdoc
     (vlax-create-object
       (if (< (setq release (atoi (getvar "ACADVER"))) 16)
         "ObjectDBX.AxDbDocument"
         (strcat "ObjectDBX.AxDbDocument." (itoa release))
       )
     )
  )
  (if (vl-catch-all-apply 'vla-open (list axdbdoc filename))
    (not (vlax-release-object axdbdoc))
    axdbdoc
  )
)

Principle of use :

Need getdir function in odbx_fct.lsp

(defun c:<foo> (/ axdoc lfil dir)
        ; Choose folder.
    (if (and (setq dir (getdir))
             (setq  lfil (vl-directory-files dir "*.dwg" 1))) 
        (foreach f lfil 
          (if (setq axdoc (getaxdbdoc (strcat dir f)))
            (progn
              ; This is where you do what you want.
              (<dofoo> axdoc)
              ; If you modify the document.
              (vla-saveas axdoc (strcat dir f))
              ; Releases a drawing object
              (vlax-release-object axdoc)
            )
          )
        )
    )
(princ)
)

Dump ObjectDBX

With (vlax-dump-object axdoc t) , you know the applicable properties and methods ObjectDBX.

; IAxDbDocument: IAxDbDocument Interface
; Property values:
;   Application (RO) = Exception occurred
;   Blocks (RO) = #<VLA-OBJECT IAcadBlocks 0000016a1a216918>
;   Database (RO) = #<VLA-OBJECT IAcadDatabase 0000016a2b9483d8>
;   Dictionaries (RO) = #<VLA-OBJECT IAcadDictionaries 0000016a1a2167f8>
;   DimStyles (RO) = #<VLA-OBJECT IAcadDimStyles 0000016a1a215cb8>
;   ElevationModelSpace = 0.0
;   ElevationPaperSpace = 0.0
;   FileDependencies (RO) = #<VLA-OBJECT IAcadFileDependencies 0000016a29b20728>
;   Groups (RO) = #<VLA-OBJECT IAcadGroups 0000016a1a2169a8>
;   Layers (RO) = #<VLA-OBJECT IAcadLayers 0000016a1a216ac8>
;   Layouts (RO) = #<VLA-OBJECT IAcadLayouts 0000016a1a2172a8>
;   Limits = (0.0 0.0 420.0 297.0)
;   Linetypes (RO) = #<VLA-OBJECT IAcadLineTypes 0000016a1a216d98>
;   Materials (RO) = #<VLA-OBJECT IAcadMaterials 0000016a1a2173c8>
;   ModelSpace (RO) = #<VLA-OBJECT IAcadModelSpace 0000016a29c2d378>
;   Name = "C:\\Data\\TMP\\dwg\\test.dwg"
;   PaperSpace (RO) = #<VLA-OBJECT IAcadPaperSpace 0000016a29c2c658>
;   PlotConfigurations (RO) = #<VLA-OBJECT IAcadPlotConfigurations 0000016a1a2186e8>
;   Preferences (RO) = #<VLA-OBJECT IAcadDatabasePreferences 0000016a29b206a8>
;   RegisteredApplications (RO) = #<VLA-OBJECT IAcadRegisteredApplications 0000016a1a217698>
;   SectionManager (RO) = Exception occurred
;   SummaryInfo (RO) = #<VLA-OBJECT IAcadSummaryInfo 0000016a2b70fe08>
;   TextStyles (RO) = #<VLA-OBJECT IAcadTextStyles 0000016a1a2184a8>
;   UserCoordinateSystems (RO) = #<VLA-OBJECT IAcadUCSs 0000016a1a218268>
;   Viewports (RO) = #<VLA-OBJECT IAcadViewports 0000016a1a217728>
;   Views (RO) = #<VLA-OBJECT IAcadViews 0000016a1a217b18>
; Methods supported:
;   CopyObjects (3)
;   DxfIn (2)
;   DxfOut (3)
;   HandleToObject (1)
;   ObjectIdToObject (1)
;   Open (2)
;   Save ()
;   SaveAs (2)

There are far fewer Methods supported than with an open document.

You can see that an exception has occurred at Application and SectionManager.

Examples of use

I remind you that there is no possible return, and that it is advisable to save your work beforehand.

Root

The Visual LISP Devepors Bible - 2011 Edition Chapter 14 By David M.Stein.

An experience of Michael_Puckett

Special thanks for Patrick_35, Gile and Lee Mac.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.