AutoCAD Architecture Customization
Welcome to Autodesk’s AutoCAD Architecture Customization Forums. Share your knowledge, ask questions, and explore popular AutoCAD Architecture Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Vlisp-ActiveX access to aecdatabase

12 REPLIES 12
Reply
Message 1 of 13
Anonymous
499 Views, 12 Replies

Vlisp-ActiveX access to aecdatabase

Since my q' was not answered, I am posting again.

since Peter recently talked about this subject, I wanted to askhow
to gain access to the aecArchDatabasePreferences database, so I can get
the properties in there ;ole DatabaseScale, etc.
using the get-property or put property routines (not sure if I use
those.)
I was asking on how to gain access to the aecdatabase via
vlisp-activeX:, I can access properties of selected objects, but how to
pull from
database , like the scale, etc. I am looking for the translation from
VBA to VLISP..
of
I am stuck at this point
(setq acadDoc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
I cannot figure out what the next step would be to get to the
AecArchBaseDatabasePreferences

Rob vba routine
Public Sub PrefAccess()
Dim doc As New AecArchBaseDocument
Dim Pref As AecArchBaseDatabasePreferences
doc.Init ThisDrawing
Set doc = AecArchBaseApplication.ActiveDocument
Set Pref = doc.Preferences
Pref.DatabaseScale = 192
Pref.OLELaunch = True
End Sub

thanks
--

-------------------
Nauman M
CAD Bazaar
Need to easily Navigate to your Custom Content Folders?
Need Autolayering for Dimensions without going through Design Center?
Download the updated ADT Tools for ADT 2 & 3 at
http://www.cadbazaar.com
12 REPLIES 12
Message 2 of 13
Anonymous
in reply to: Anonymous

Nauman M,

I don't have Aec loaded so I can't really access "DatabaseScale". I'm going
to assume the problem is how to get the "Preferences" object. Here's an
AutoCAD example:

(defun foo()
(vl-load-com)
(setq acadDoc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT)))
(setq acadPref (vlax-get-property acadDoc "Preferences")) ;; renamed
version of vlax-get
(setq bar (vlax-get-property acadPref "XrefEdit")) ;; try "DatabaseScale"
instead of "XrefEdit"
)

Steve

"> I am stuck at this point
> (setq acadDoc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
> I cannot figure out what the next step would be to get to the
> AecArchBaseDatabasePreferences
>
> Rob vba routine
> Public Sub PrefAccess()
> Dim doc As New AecArchBaseDocument
> Dim Pref As AecArchBaseDatabasePreferences
> doc.Init ThisDrawing
> Set doc = AecArchBaseApplication.ActiveDocument
> Set Pref = doc.Preferences
> Pref.DatabaseScale = 192
> Pref.OLELaunch = True
> End Sub
>
> thanks
> --
Message 3 of 13
Anonymous
in reply to: Anonymous

I have not seen a way to get the AecDocument database from VLISP. I have
been in VBA doing this. What are you trying to do? why not VBA?

Rob Starz
www.stardsign.com


"Nauman M" wrote in message
news:3B6EF3E6.94B6B2B2@email.com...
> Since my q' was not answered, I am posting again.
>
> since Peter recently talked about this subject, I wanted to askhow
> to gain access to the aecArchDatabasePreferences database, so I can get
> the properties in there ;ole DatabaseScale, etc.
> using the get-property or put property routines (not sure if I use
> those.)
> I was asking on how to gain access to the aecdatabase via
> vlisp-activeX:, I can access properties of selected objects, but how to
> pull from
> database , like the scale, etc. I am looking for the translation from
> VBA to VLISP..
> of
> I am stuck at this point
> (setq acadDoc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
> I cannot figure out what the next step would be to get to the
> AecArchBaseDatabasePreferences
>
> Rob vba routine
> Public Sub PrefAccess()
> Dim doc As New AecArchBaseDocument
> Dim Pref As AecArchBaseDatabasePreferences
> doc.Init ThisDrawing
> Set doc = AecArchBaseApplication.ActiveDocument
> Set Pref = doc.Preferences
> Pref.DatabaseScale = 192
> Pref.OLELaunch = True
> End Sub
>
> thanks
> --
>
> -------------------
> Nauman M
> CAD Bazaar
> Need to easily Navigate to your Custom Content Folders?
> Need Autolayering for Dimensions without going through Design Center?
> Download the updated ADT Tools for ADT 2 & 3 at
> http://www.cadbazaar.com
Message 4 of 13
Anonymous
in reply to: Anonymous

"What are you trying to do? why not VBA?"

have not learned it yet... and tried the home work peter had, was
partially successful on that.
and most all my stuff is in LISP that needs to use that functionality...
I can get to the scale via lisp/dictionaries but wanted to learn the
vlisp activeX functionality as well.
more so a curiosity thing.
I guess I will wait for peter to reply on this one.
maybe he is not going to answer, since he is a VBA pusher

As for Steve's answer, I tried to do that , but there is no property in
AcadDoc, I tried that laready, rather it is aecdoc property I am after,




Rob Starz wrote:
>
> I have not seen a way to get the AecDocument database from VLISP. I have
> been in VBA doing this. What are you trying to do? why not VBA?
>
> Rob Starz
> www.stardsign.com
>
> "Nauman M" wrote in message
> news:3B6EF3E6.94B6B2B2@email.com...
> > Since my q' was not answered, I am posting again.
> >
> > since Peter recently talked about this subject, I wanted to askhow
> > to gain access to the aecArchDatabasePreferences database, so I can get
> > the properties in there ;ole DatabaseScale, etc.
> > using the get-property or put property routines (not sure if I use
> > those.)
> > I was asking on how to gain access to the aecdatabase via
> > vlisp-activeX:, I can access properties of selected objects, but how to
> > pull from
> > database , like the scale, etc. I am looking for the translation from
> > VBA to VLISP..
> > of
> > I am stuck at this point
> > (setq acadDoc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
> > I cannot figure out what the next step would be to get to the
> > AecArchBaseDatabasePreferences
> >
> > Rob vba routine
> > Public Sub PrefAccess()
> > Dim doc As New AecArchBaseDocument
> > Dim Pref As AecArchBaseDatabasePreferences
> > doc.Init ThisDrawing
> > Set doc = AecArchBaseApplication.ActiveDocument
> > Set Pref = doc.Preferences
> > Pref.DatabaseScale = 192
> > Pref.OLELaunch = True
> > End Sub
> >
> > thanks
> > --
> >
> > -------------------
> > Nauman M
> > CAD Bazaar
> > Need to easily Navigate to your Custom Content Folders?
> > Need Autolayering for Dimensions without going through Design Center?
> > Download the updated ADT Tools for ADT 2 & 3 at
> > http://www.cadbazaar.com

--

-------------------
Nauman M
CAD Bazaar
Need to easily Navigate to your Custom Content Folders?
Need Autolayering for Dimensions without going through Design Center?
Download the updated ADT Tools for ADT 2 & 3 at
http://www.cadbazaar.com
Message 5 of 13
Anonymous
in reply to: Anonymous

Nauman,

I've tried to get there with Visual Lisp without any luck. I can get close,
but there are some differences that prevent me from getting the correct
object in VL.

Did you know that John Janzen is teaching a 4 hour tutorial on VBA for ADT
at AU?

Peter Funk
API Product Manager
Building Industry Group
Autodesk, Inc.



"Nauman M" wrote in message
news:3B6FECFF.55A7E962@email.com...
> "What are you trying to do? why not VBA?"
>
> have not learned it yet... and tried the home work peter had, was
> partially successful on that.
> and most all my stuff is in LISP that needs to use that functionality...
> I can get to the scale via lisp/dictionaries but wanted to learn the
> vlisp activeX functionality as well.
> more so a curiosity thing.
> I guess I will wait for peter to reply on this one.
> maybe he is not going to answer, since he is a VBA pusher
>
> As for Steve's answer, I tried to do that , but there is no property in
> AcadDoc, I tried that laready, rather it is aecdoc property I am after,
>
>
>
>
> Rob Starz wrote:
> >
> > I have not seen a way to get the AecDocument database from VLISP. I
have
> > been in VBA doing this. What are you trying to do? why not VBA?
> >
> > Rob Starz
> > www.stardsign.com
> >
> > "Nauman M" wrote in message
> > news:3B6EF3E6.94B6B2B2@email.com...
> > > Since my q' was not answered, I am posting again.
> > >
> > > since Peter recently talked about this subject, I wanted to askhow
> > > to gain access to the aecArchDatabasePreferences database, so I can
get
> > > the properties in there ;ole DatabaseScale, etc.
> > > using the get-property or put property routines (not sure if I use
> > > those.)
> > > I was asking on how to gain access to the aecdatabase via
> > > vlisp-activeX:, I can access properties of selected objects, but how
to
> > > pull from
> > > database , like the scale, etc. I am looking for the translation from
> > > VBA to VLISP..
> > > of
> > > I am stuck at this point
> > > (setq acadDoc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
> > > I cannot figure out what the next step would be to get to the
> > > AecArchBaseDatabasePreferences
> > >
> > > Rob vba routine
> > > Public Sub PrefAccess()
> > > Dim doc As New AecArchBaseDocument
> > > Dim Pref As AecArchBaseDatabasePreferences
> > > doc.Init ThisDrawing
> > > Set doc = AecArchBaseApplication.ActiveDocument
> > > Set Pref = doc.Preferences
> > > Pref.DatabaseScale = 192
> > > Pref.OLELaunch = True
> > > End Sub
> > >
> > > thanks
> > > --
> > >
> > > -------------------
> > > Nauman M
> > > CAD Bazaar
> > > Need to easily Navigate to your Custom Content Folders?
> > > Need Autolayering for Dimensions without going through Design Center?
> > > Download the updated ADT Tools for ADT 2 & 3 at
> > > http://www.cadbazaar.com
>
> --
>
> -------------------
> Nauman M
> CAD Bazaar
> Need to easily Navigate to your Custom Content Folders?
> Need Autolayering for Dimensions without going through Design Center?
> Download the updated ADT Tools for ADT 2 & 3 at
> http://www.cadbazaar.com
Message 6 of 13
Anonymous
in reply to: Anonymous

that is Las Vegas right? Thinking about going to it.

--
-------------------------------------------------------------------------
Rob Starz
Plogv 3.0 & 2000 (plot logging) for r14 & 2000
***Enhancement Tools for Arch. Desktop *****
!!!!!Beta Testers Needed For DormerX!!!!!!!
http://www.stardsign.com/DormerXForm.htm
http://www.stardsign.com/main.htm
Message 7 of 13
Anonymous
in reply to: Anonymous

I hope to see you there Rob. If I make it, I'll be in John's class for
sure.
--
Bobby C. Jones
Message 8 of 13
Anonymous
in reply to: Anonymous

Rob,

That's right at the MGM in Las Vegas.

Peter
Message 9 of 13
Anonymous
in reply to: Anonymous

I am trying to convince my boss right now!!
being a tough market, its going to be tough , but will see.


"Peter Funk - Autodesk, Inc" wrote in message
news:27C5E68C53467D0C5A39BADA2948405C@in.WebX.maYIadrTaRb...
> Nauman,
>
> I've tried to get there with Visual Lisp without any luck. I can get
close,
> but there are some differences that prevent me from getting the correct
> object in VL.
>
> Did you know that John Janzen is teaching a 4 hour tutorial on VBA for ADT
> at AU?
>
> Peter Funk
> API Product Manager
> Building Industry Group
> Autodesk, Inc.
>
>
>
> "Nauman M" wrote in message
> news:3B6FECFF.55A7E962@email.com...
> > "What are you trying to do? why not VBA?"
> >
> > have not learned it yet... and tried the home work peter had, was
> > partially successful on that.
> > and most all my stuff is in LISP that needs to use that functionality...
> > I can get to the scale via lisp/dictionaries but wanted to learn the
> > vlisp activeX functionality as well.
> > more so a curiosity thing.
> > I guess I will wait for peter to reply on this one.
> > maybe he is not going to answer, since he is a VBA pusher
> >
> > As for Steve's answer, I tried to do that , but there is no property in
> > AcadDoc, I tried that laready, rather it is aecdoc property I am after,
> >
> >
> >
> >
> > Rob Starz wrote:
> > >
> > > I have not seen a way to get the AecDocument database from VLISP. I
> have
> > > been in VBA doing this. What are you trying to do? why not VBA?
> > >
> > > Rob Starz
> > > www.stardsign.com
> > >
> > > "Nauman M" wrote in message
> > > news:3B6EF3E6.94B6B2B2@email.com...
> > > > Since my q' was not answered, I am posting again.
> > > >
> > > > since Peter recently talked about this subject, I wanted to askhow
> > > > to gain access to the aecArchDatabasePreferences database, so I can
> get
> > > > the properties in there ;ole DatabaseScale, etc.
> > > > using the get-property or put property routines (not sure if I use
> > > > those.)
> > > > I was asking on how to gain access to the aecdatabase via
> > > > vlisp-activeX:, I can access properties of selected objects, but how
> to
> > > > pull from
> > > > database , like the scale, etc. I am looking for the translation
from
> > > > VBA to VLISP..
> > > > of
> > > > I am stuck at this point
> > > > (setq acadDoc (VLA-GET-ACTIVEDOCUMENT (VLAX-GET-ACAD-OBJECT))
> > > > I cannot figure out what the next step would be to get to the
> > > > AecArchBaseDatabasePreferences
> > > >
> > > > Rob vba routine
> > > > Public Sub PrefAccess()
> > > > Dim doc As New AecArchBaseDocument
> > > > Dim Pref As AecArchBaseDatabasePreferences
> > > > doc.Init ThisDrawing
> > > > Set doc = AecArchBaseApplication.ActiveDocument
> > > > Set Pref = doc.Preferences
> > > > Pref.DatabaseScale = 192
> > > > Pref.OLELaunch = True
> > > > End Sub
> > > >
> > > > thanks
> > > > --
> > > >
> > > > -------------------
> > > > Nauman M
> > > > CAD Bazaar
> > > > Need to easily Navigate to your Custom Content Folders?
> > > > Need Autolayering for Dimensions without going through Design
Center?
> > > > Download the updated ADT Tools for ADT 2 & 3 at
> > > > http://www.cadbazaar.com
> >
> > --
> >
> > -------------------
> > Nauman M
> > CAD Bazaar
> > Need to easily Navigate to your Custom Content Folders?
> > Need Autolayering for Dimensions without going through Design Center?
> > Download the updated ADT Tools for ADT 2 & 3 at
> > http://www.cadbazaar.com
>
>
Message 10 of 13
Anonymous
in reply to: Anonymous

I tell you, last year experience was EXCELLENT!!! the facilities, the
classes, the freebies/events were all excellent. I have nothing bad to say
except that some classes were too short for their content, i.e. viz by Ted
boardman and other viz classes as well


"Peter Funk - Autodesk, Inc" wrote in message
news:f0708fa.6@WebX.maYIadrTaRb...
> Rob,
>
> That's right at the MGM in Las Vegas.
>
> Peter
>
>
Message 11 of 13
Anonymous
in reply to: Anonymous

okay here goes something, thanks to Steve, with an excellent response, I am
still trying to digest
about the COM and things...but any case I get Exception occrred when I use
the method


(setq aec (vlax-get-or-create-object
"{A91488C8-82E9-11D2-9C0F-0080C7D6CCA4}"))
#

Command: (setq ss (vlax-dump-object aec))

; IAecArchBaseApplication: AEC Application object, extending the
AcadApplication object to provide support for Architectural and general AEC
objects
; Property values:

; Preferences (RO) = #

Command: (vlax-get-property aec "DatabaseScale")
; error: Automation Error. Description was not provided.
Command: (setq aec (vlax-get-or-create-object
"{530A5174-F0CE-11D2-A87D-0080C7D6CCA4}"))
#

Command: (setq ss (vlax-dump-object aec))
; IAecArchBaseDatabasePreferences: This object supports all AutoCAD, AEC
Base
and ADT Architectural Database preferences
; Property values:
; AllowLongSymbolNames = Exception occurred
; AngularAzimuth = Exception occurred
; AngularDisplayFormat = Exception occurred
; AngularPrecision = Exception occurred
; Application (RO) = Exception occurred
; AreaDisplayUnit = Exception occurred
; AreaPrecision = Exception occurred
; AreaSuffix = Exception occurred
; BasePoint = Exception occurred
; BasePointNE = Exception occurred
; ContourLinesPerSurface = Exception occurred
; CoordinatePrecision = Exception occurred
; Database = Exception occurred
; DatabaseScale = Exception occurred
; DisplaySilhouette = Exception occurred
; ElevationPrecision = Exception occurred
; FacetDeviation = Exception occurred
; LayerFile = Exception occurred
; LayerStandard = Exception occurred
; LinearDisplayFormat = Exception occurred
; LinearPrecision = Exception occurred
; LinearUnit = Exception occurred
; Lineweight = Exception occurred
; LineWeightDisplay = Exception occurred
; MaxActiveViewports = Exception occurred
; MeasurementUnit (RO) = Exception occurred
; NorthRotation = Exception occurred
; ObjectSortByPlotting = Exception occurred
; ObjectSortByPSOutput = Exception occurred
; ObjectSortByRedraws = Exception occurred
; ObjectSortByRegens = Exception occurred
; ObjectSortBySelection = Exception occurred
; ObjectSortBySnap = Exception occurred
; OLELaunch = Exception occurred
; ProjectName = Exception occurred
; RenderSmoothness = Exception occurred
; ScaleOnInsert = Exception occurred
; SegmentPerPolyline = Exception occurred
; SolidFill = Exception occurred
; TextFrameDisplay = Exception occurred
; TextHeight = Exception occurred
; VerticalScale = Exception occurred
; VolumeDisplayUnit = Exception occurred
; VolumePrecision = Exception occurred
; VolumeSuffix = Exception occurred
; XRefEdit = Exception occurred
; XRefLayerVisibility = Exception occurred
T


Command: (setq rr (vlax-get-property aec "Preferences"))
; error: Exception occurred: 0xC0000005 (Access Violation)
; warning: unwind skipped on unknown exception
Message 12 of 13
Anonymous
in reply to: Anonymous

This may have to do with the document not being initialized.

In VB you dim the Doc then Doc.Init.

I believe Mark mentioned this sometime back. I am clueless on this area.

--
-------------------------------------------------------------------------
Rob Starz
Plogv 3.0 & 2000 (plot logging) for r14 & 2000
***Enhancement Tools for Arch. Desktop *****
!!!!!Beta Testers Needed For DormerX!!!!!!!
http://www.stardsign.com/DormerXForm.htm
http://www.stardsign.com/main.htm
"Nauman M" wrote in message
news:4F9AF18FC93FC157500EA532DCF7B4E1@in.WebX.maYIadrTaRb...
> okay here goes something, thanks to Steve, with an excellent response, I
am
> still trying to digest
> about the COM and things...but any case I get Exception occrred when I use
> the method
>
>
> (setq aec (vlax-get-or-create-object
> "{A91488C8-82E9-11D2-9C0F-0080C7D6CCA4}"))
> #
>
> Command: (setq ss (vlax-dump-object aec))
>
> ; IAecArchBaseApplication: AEC Application object, extending the
> AcadApplication object to provide support for Architectural and general
AEC
> objects
> ; Property values:
>
> ; Preferences (RO) = #
>
> Command: (vlax-get-property aec "DatabaseScale")
> ; error: Automation Error. Description was not provided.
> Command: (setq aec (vlax-get-or-create-object
> "{530A5174-F0CE-11D2-A87D-0080C7D6CCA4}"))
> #
>
> Command: (setq ss (vlax-dump-object aec))
> ; IAecArchBaseDatabasePreferences: This object supports all AutoCAD, AEC
> Base
> and ADT Architectural Database preferences
> ; Property values:
> ; AllowLongSymbolNames = Exception occurred
> ; AngularAzimuth = Exception occurred
> ; AngularDisplayFormat = Exception occurred
> ; AngularPrecision = Exception occurred
> ; Application (RO) = Exception occurred
> ; AreaDisplayUnit = Exception occurred
> ; AreaPrecision = Exception occurred
> ; AreaSuffix = Exception occurred
> ; BasePoint = Exception occurred
> ; BasePointNE = Exception occurred
> ; ContourLinesPerSurface = Exception occurred
> ; CoordinatePrecision = Exception occurred
> ; Database = Exception occurred
> ; DatabaseScale = Exception occurred
> ; DisplaySilhouette = Exception occurred
> ; ElevationPrecision = Exception occurred
> ; FacetDeviation = Exception occurred
> ; LayerFile = Exception occurred
> ; LayerStandard = Exception occurred
> ; LinearDisplayFormat = Exception occurred
> ; LinearPrecision = Exception occurred
> ; LinearUnit = Exception occurred
> ; Lineweight = Exception occurred
> ; LineWeightDisplay = Exception occurred
> ; MaxActiveViewports = Exception occurred
> ; MeasurementUnit (RO) = Exception occurred
> ; NorthRotation = Exception occurred
> ; ObjectSortByPlotting = Exception occurred
> ; ObjectSortByPSOutput = Exception occurred
> ; ObjectSortByRedraws = Exception occurred
> ; ObjectSortByRegens = Exception occurred
> ; ObjectSortBySelection = Exception occurred
> ; ObjectSortBySnap = Exception occurred
> ; OLELaunch = Exception occurred
> ; ProjectName = Exception occurred
> ; RenderSmoothness = Exception occurred
> ; ScaleOnInsert = Exception occurred
> ; SegmentPerPolyline = Exception occurred
> ; SolidFill = Exception occurred
> ; TextFrameDisplay = Exception occurred
> ; TextHeight = Exception occurred
> ; VerticalScale = Exception occurred
> ; VolumeDisplayUnit = Exception occurred
> ; VolumePrecision = Exception occurred
> ; VolumeSuffix = Exception occurred
> ; XRefEdit = Exception occurred
> ; XRefLayerVisibility = Exception occurred
> T
>
>
> Command: (setq rr (vlax-get-property aec "Preferences"))
> ; error: Exception occurred: 0xC0000005 (Access Violation)
> ; warning: unwind skipped on unknown exception
>
>
>
Message 13 of 13
jbuzbee
in reply to: Anonymous

Look for "AecArchBaseDocument" in "Customer Files". It contains an example; "AecUtil.lsp", which can be used in place of (vla-get-activedocument(vlac-get-acad-object)) for accessing the AecArchBaseDoc. I've included a number of comments to explain what I've done and so forth. What we could all do to expand this code would be configuration checking for multiple versions and platforms. The example works for ADT 3 with a sloght modification to work on ADT 3.3. If any of you have time to download it and check it out I would appreciate any feedback!! James Buzbee

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost