+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 25
  1. #1
    Full Member Keywordkid's Avatar
    Computer Details
    Keywordkid's Computer Details
    Operating System:
    Win 7
    Discipline
    Architectural
    Keywordkid's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Location
    London, UK
    Posts
    67

    Default Define a regen after closing DWGPROPS?

    Registered forum members do not see this ad.

    Hi folks,

    I have very limited lisp understanding and generally try to work with what i have already been shown. I want to set up a ribbon tool for users to enter drawing details in the document properties which will auto fill the custom fields I have set up in our template file layout tabs. Currently when the edit is comlete and the dialogue is closed the fields remain unchanged until a regen is performed. Below is my poor attempt at redefining the dwgprops command but it clearly doesn't work.

    Code:
    ; Define Document properties to regen on close
    (command ".undefine" "dwgprops")
    (defun c:dwgprops ()
    (setvar "cmdecho" 0)
    (command "-dwgprops")
    (command ".regen")
    (command ".dwgprops)
    (setvar "cmdecho" 1)
    (princ)
    )
    If it is possible I'd welcome some pointers - thanks.

  2. #2
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,932

    Default

    Couple of things....

    First, you seem to be missing a close quote here:

    Quote Originally Posted by Keywordkid View Post
    Code:
    ; Define Document properties to regen on close
    (command ".undefine" "dwgprops")
    (defun c:dwgprops ()
    (setvar "cmdecho" 0)
    (command "-dwgprops")
    (command ".regen")
    (command ".dwgprops")
    (setvar "cmdecho" 1)
    (princ)
    )
    If it is possible I'd welcome some pointers - thanks.
    Your logic is sound, in that you're wanting the changes made to DwgProps to be reflected when you're done making changes. Where you've overlooked one option for accomplishing this is by not having a bit more experience - Don't worry, you'll get there.

    When you consider that you're wanting to consistently perform a supplementary action following a specific Command, Undefining, and Redefining is one way to go about it. Were I to do this (and I may now add this to my setup, so for that I thank you for asking the question), I would employ a simple Command Reactor.

    By using a Visual LISP Command Reactor, we can preclude the need to undefine a Command (in this case DwgProps), and instead simply monitor for the CommandEnded event (in lieu of CommandWillStart, CommandCancelled, etc.), as only when the DwgProps Command has successfully ended do we want our supplementary action to take place (in this case a regen).

    Another advantage of using Visual LISP in this case is that we can regen the viewports without using another Command, as this has been exposed to the ActiveX API.

    What does all of this look like?

    Simple; to test load this psuedo-code:

    Code:
    (vl-load-com)
    
    (defun DwgPropsCommandReactor:Start ()
      (or *DwgPropsCommandReactor*
          (setq *DwgPropsCommandReactor*
                 (vlr-command-reactor
                   "DwgPropsCommandReactor"
                   '(
                     (:vlr-commandended . DwgPropsCallback:CommandEnded)
                    )
                 )
          )
      )
      (prompt "\n  >>  DwgProps command reactor loaded ")
      (princ)
    )
    
    (defun DwgPropsCallback:CommandEnded (rea cmd)
      (if (wcmatch (strcase (car cmd)) "DWGPROPS")
        (vla-regen (vla-get-activedocument (vlax-get-acad-object))
                   acAllViewports
        )
      )
    )
    
    (defun c:StopR ()
      (if *DwgPropsCommandReactor*
        (progn
          (vlr-remove *DwgPropsCommandReactor*)
          (setq *DwgPropsCommandReactor* nil)
          (prompt "\n** DwgProps command reactor stopped ** ")
        )
      )
      (princ)
    )
    
    (DwgPropsCommandReactor:Start)
    ** Note - Be sure to NOT have the DwgProps Command undefined.

    ** Edit to add - I've also included a "STOPR" command so that if you'd like to turn this reactor of, you may.

    HTH
    Last edited by BlackBox; 26th Oct 2012 at 06:02 pm.
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Full Member Keywordkid's Avatar
    Computer Details
    Keywordkid's Computer Details
    Operating System:
    Win 7
    Discipline
    Architectural
    Keywordkid's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Location
    London, UK
    Posts
    67

    Default

    Many Thanks RenderMan,

    Glad my idea may prove useful I'll give your code a try and see if I don't make a mess of it

  4. #4
    Full Member Keywordkid's Avatar
    Computer Details
    Keywordkid's Computer Details
    Operating System:
    Win 7
    Discipline
    Architectural
    Keywordkid's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Location
    London, UK
    Posts
    67

    Star Works perfectly

    Thanks RenderMan - This works a treat! I just need to update the company Ribbon tools to include DWGPROPS to make it simple to run.

  5. #5
    Full Member Keywordkid's Avatar
    Computer Details
    Keywordkid's Computer Details
    Operating System:
    Win 7
    Discipline
    Architectural
    Keywordkid's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Location
    London, UK
    Posts
    67

    Default

    HI RM,

    Related to my initial idea, do you know if there is a method for pre-selecting the 'custom' tab in the DWGPROPS dialogue? - I want to make it as easy as possible to edit the fields for the users without running through instructions and tutorials.

    Thanks,

    KWK

  6. #6
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,932

    Default

    Quote Originally Posted by Keywordkid View Post
    Thanks RenderMan - This works a treat! I just need to update the company Ribbon tools to include DWGPROPS to make it simple to run.
    Sorry for the delayed response - You're welcome, I'm happy to help.

    Quote Originally Posted by Keywordkid View Post
    Related to my initial idea, do you know if there is a method for pre-selecting the 'custom' tab in the DWGPROPS dialogue? - I want to make it as easy as possible to edit the fields for the users without running through instructions and tutorials.
    Unfortunately not that I am aware of; once within a Command's dialog, AutoLISP, and even Visual LISP for that matter, are of little use.
    "Potential has a shelf life." - Margaret Atwood

  7. #7
    Full Member Keywordkid's Avatar
    Computer Details
    Keywordkid's Computer Details
    Operating System:
    Win 7
    Discipline
    Architectural
    Keywordkid's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Location
    London, UK
    Posts
    67

    Default

    I thought that might be the case when Googling gave me no useful results, I've resorted to some text instructions in Defpoints just off the side of the Layout and hope the users will actually read it!!

    Thanks for your help.

  8. #8
    Senior Member kruuger's Avatar
    Computer Details
    kruuger's Computer Details
    Operating System:
    Xp 64bit
    Using
    AutoCAD 2010
    Join Date
    Dec 2007
    Location
    Poland
    Posts
    179

    Default

    Quote Originally Posted by Keywordkid View Post
    HI RM,

    Related to my initial idea, do you know if there is a method for pre-selecting the 'custom' tab in the DWGPROPS dialogue?

    Thanks,
    KWK
    yes, with own custom prop dcl window
    pros:
    - multiple delete
    - reorder, up-down
    cons:
    - not re-sizable

    kruuger
    Attached Images
    Attached Files

  9. #9
    Full Member Keywordkid's Avatar
    Computer Details
    Keywordkid's Computer Details
    Operating System:
    Win 7
    Discipline
    Architectural
    Keywordkid's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2012
    Join Date
    Jun 2012
    Location
    London, UK
    Posts
    67

    Default

    This looks interesting, is it just the dcl file that I need to edit for my preferred fields?

  10. #10
    Senior Member kruuger's Avatar
    Computer Details
    kruuger's Computer Details
    Operating System:
    Xp 64bit
    Using
    AutoCAD 2010
    Join Date
    Dec 2007
    Location
    Poland
    Posts
    179

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Keywordkid View Post
    This looks interesting, is it just the dcl file that I need to edit for my preferred fields?
    what do mean by fields ?

    you can change width of DCL to make it wider.
    more props looks like this:

    kruuger
    Attached Images

Similar Threads

  1. GUI for dwgprops
    By memphis710 in forum AutoCAD General
    Replies: 1
    Last Post: 6th Mar 2012, 06:02 pm
  2. Edit Dwgprops via ObjectDBX
    By Ahankhah in forum AutoLISP, Visual LISP & DCL
    Replies: 15
    Last Post: 9th Feb 2012, 08:31 am
  3. LISP to edit DWGPROPS
    By eric_monceaux in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 9th Nov 2009, 03:36 pm
  4. DWGPROPS Navigation
    By eric_monceaux in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 13th Oct 2009, 10:21 pm
  5. dwgprops
    By fuccaro in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 13th May 2004, 04:39 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts