BlackBox Posted July 9, 2012 Posted July 9, 2012 Thank for all your help. Even if you can't get it spot on, you're giving me plenty of info to run with. I'm always happy to not help. How about the AecX.AecBaseApplication Object dump... anything worthwhile come from that? Quote
Lee Roy Posted July 9, 2012 Author Posted July 9, 2012 It returned: ; IAecBaseApplication: AEC base application object, extending the AcadApplication object to provide support for general AEC objects ; Property values: ; ActiveDocument = Exception occurred ; Application (RO) = Exception occurred ; Caption (RO) = Exception occurred ; Documents (RO) = Exception occurred ; FullName (RO) = Exception occurred ; Height = Exception occurred ; HWND (RO) = Exception occurred ; HWND32 (RO) = Exception occurred ; LocaleId (RO) = Exception occurred ; MenuBar (RO) = Exception occurred ; MenuGroups (RO) = Exception occurred ; Name (RO) = Exception occurred ; Path (RO) = Exception occurred ; Preferences (RO) = Exception occurred ; StatusId (RO) = ...Indexed contents not shown... ; VBE (RO) = Exception occurred ; Version (RO) = Exception occurred ; Visible = Exception occurred ; Width = Exception occurred ; WindowLeft = Exception occurred ; WindowState = Exception occurred ; WindowTop = Exception occurred ; Methods supported: ; Eval (1) ; GetAcadState () ; GetInterfaceObject (1) ; Init (1) ; ListArx () ; LoadArx (1) ; LoadDVB (1) ; Quit () ; RunMacro (1) ; UnloadArx (1) ; UnloadDVB (1) ; Update () ; ZoomAll () ; ZoomCenter (2) ; ZoomExtents () ; ZoomPickWindow () ; ZoomPrevious () ; ZoomScaled (2) ; ZoomWindow (2) 0 Nothing particularly stands out to me, but I'm also still n00b at this whole LISP stuff. Blah ... when I'm done here, I have an engine rebuild to do on my motorcycle, troubleshoot some hot-start issues on my car then onto some PHP and HTML for the evening. Quote
BlackBox Posted July 9, 2012 Posted July 9, 2012 Not that I still won't need more information, but I may end up having to hop into Visual Studio to code a LispFunction Method if this Property is not exposed to Visual LISP (ActiveX) API. ... Perhaps someone with more working knowledge of customizing AMEP can point me in the right direction? Quote
Lee Roy Posted July 9, 2012 Author Posted July 9, 2012 On the off-chance it would be easy, I checked SYSVAR -> ? -> * and nothing in the entire list contained the project number. Was hoping... Quote
BlackBox Posted July 10, 2012 Posted July 10, 2012 Rarely is 'vertical' data easily accessible via system variables; usually an interface object query is all that is needed. Usually, there's only a small number of, but it appears that MEP has a plethora given the Architectural, and Plumbing API's. Quote
Lee Roy Posted July 10, 2012 Author Posted July 10, 2012 Until I/we figure out how to pull that data automatically, I've done the following workaround: This loads into each drawing via acaddoc: (defun c:FOO () (if (/= (getvar "loginname") "LeeRoy") (alert "You are not authorized to use this function.") (vlax-ldata-put "PlotStyle" "01" "Skip") ) ) (defun c:FOO2 () (if (/= (getvar "loginname") "LeeRoy") (alert "You are not authorized to use this function.") (vlax-ldata-put "PlotStyle" "01" "DontSkip") ) ) This runs runs with each document, via acaddoc: (defun c:FOO3 (/ activedoc activelay pltstyl skip) (vl-load-com) (setq activedoc (vla-get-activedocument(vlax-get-acad-object))) (setq activelay (vla-get-activelayout activedoc)) (setq pltstyl.setstring(vla-get-StyleSheet activelay)) (setq skip (vlax-ldata-get "PlotStyle" "01")) (cond ((= skip "Skip") (alert "\nNon-standard .ctb detected.\nPlotStyle1 Standards loaded.\nVerify .ctb to be used.") ) ((= pltstyl "PlotStyle3.ctb") (c:PlotStyle3)) ((= pltstyl "PlotStyle2.ctb") (c:PlotStyle2)) ((= pltstyl "PlotStyle1.ctb") (c:PlotStyle1)) (t (vla-put-StyleSheet activelay "PlotStyle1.ctb") (c:PlotStyle1) (alert "\nNon-standard .ctb detected.\nPlotStyle1 loaded.") ) ) (princ) ) What I'm doing is I call a function that pre-loads a given set of text/dimension/table/leader styles based on the plotstyle/.ctb being used. If the .ctb is not recognized as one of the 3 standard, it defaults to "PlotStyle1". The workaround is to execute the c:FOO function. This allows the c:FOO3 to bypass defaulting to "PlotStyle1.ctb". To disable, simply run c:FOO2. It's my workaround for the time being. To implement it in a project requires quite a bit of effort on my part, as I don't want the users to know the command and circumvent the whole process whenever they see fit. So I'm still looking for a way to do it via the Project Number in the Project Navigator. Quote
BlackBox Posted July 10, 2012 Posted July 10, 2012 (edited) FWIW - (vl-load-com) ;;;--------------------------------------------------------------------; ;;; Unprotect symbols: (pragma '((unprotect-assign Aec-Get-Project))) ;;;--------------------------------------------------------------------; ;;; Aec-Get-Project function: (defun Aec-Get-Project (/ *error* oText project) ;; RenderMan, 2012 ;; Example: (if (= "1000.00" (Aec-Get-Project)) T nil) (defun *error* (msg) (if oText (vla-delete oText) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ) ; Fatal error, display it (princ) ) (setq oText (vla-addmtext (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)) ) (vlax-3d-point '(0 0 0)) 0. "%<\\AecPr \"ProjectNumber\">%" ) ) (setq project (vla-get-textstring oText)) (setq oText (vla-delete oText)) project ) ;;;--------------------------------------------------------------------; ;;; Protect symbols: (pragma '((protect-assign Aec-Get-Project))) ;;;--------------------------------------------------------------------; (princ) ... Let me know what you come up with, if this is useful to you? Edited July 10, 2012 by BlackBox Quote
Lee Roy Posted July 10, 2012 Author Posted July 10, 2012 "%<[color="red"]\[/color]\AecPr \"ProjectNumber\">%" I'm learning! Thank you! Will post results shortly. Quote
Lee Roy Posted July 10, 2012 Author Posted July 10, 2012 So here is the result, it's working great! Thank you so much RenderMan! This is loaded and c:InsDS is called from acaddoc to run when a document opens. (vl-load-com) ;;;--------------------------------------------------------------------; ;;; Unprotect symbols: (pragma '((unprotect-assign Aec-Get-Project))) ;;;--------------------------------------------------------------------; ;;; Aec-Get-Project function: (defun Aec-Get-Project (/ *error* oText project) ;; RenderMan, 2012 ;; Example: (if (= "1000.00" (Aec-Get-Project)) T nil) (defun *error* (msg) (if oText (vla-delete oText) ) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ) ; Fatal error, display it (princ) ) (setq oText (vla-addmtext (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)) ) (vlax-3d-point '(0 0 0)) 0. "%<\AecPr \"ProjectNumber\">%" ) ) (setq project (vla-get-textstring oText)) (setq oText (vla-delete oText)) project ) ;;;--------------------------------------------------------------------; ;;; Protect symbols: (pragma '((protect-assign Aec-Get-Project))) ;;;--------------------------------------------------------------------; (princ) (defun c:InsDS (/ activedoc activelay pltstyl skip) (vl-load-com) (setq activedoc (vla-get-activedocument(vlax-get-acad-object))) (setq activelay (vla-get-activelayout activedoc)) (setq pltstyl.setstring(vla-get-StyleSheet activelay)) (setq skip (vlax-ldata-get "PlotStyle" "01")) (cond ((= "1000.00" (Aec-Get-Project)) (alert "\nNon-standard .ctb detected.\nPlotStyle1 Standards loaded.\nVerify .ctb to be used.") ) ((= pltstyl "PlotStyle3.ctb") (c:PlotStyle3)) ((= pltstyl "PlotStyle2.ctb") (c:PlotStyle2)) ((= pltstyl "PlotStyle1.ctb") (c:PlotStyle1)) (t (vla-put-StyleSheet activelay "PlotStyle1.ctb") (c:PlotStyle1) (alert "\nNon-standard .ctb detected.\nPlotStyle1 loaded.") ) ) (princ) ) Quote
BlackBox Posted July 10, 2012 Posted July 10, 2012 So here is the result, it's working great! Thank you so much RenderMan! Happy to help. This is loaded and c:InsDS is called from acaddoc to run when a document opens. ** Edit - Forgot to mention that you place the IF statement within the COND to notify the user, yet the COND statement stops there, and does not perform any action as specified within the alert? Quote
Lee Roy Posted July 10, 2012 Author Posted July 10, 2012 ** Edit - Forgot to mention that you place the IF statement within the COND to notify the user, yet the COND statement stops there, and does not perform any action as specified within the alert? Correct. If the project number 'trips' the first alert, it is merely alerting the user that they are using non-standard settings, but does not change anything. This way when someone is working in the file, they are reminded that they are not using our standard .ctb/lineweights and to draw accordingly (although our Standard text/dim/leader/etc styles are loaded every time). Quote
BlackBox Posted July 10, 2012 Posted July 10, 2012 The way the alert string reads suggested to me that some action was being taken, but hey... If you're happy, then I'm happy. Quote
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.