+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 11 to 20 of 24
  1. #11
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Win 7 Pro / Win 10 Pro / Linux Mint
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2018
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,574

    Default

    Registered forum members do not see this ad.

    No probs
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  2. #12
    Forum Newbie
    Computer Details
    mk4176's Computer Details
    Operating System:
    Windows, QTS, DSM
    Computer:
    Dell Inc. OptiPlex 7010
    Motherboard:
    Dell Inc.
    CPU:
    Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
    RAM:
    16.0 GB
    Graphics:
    2 X NVIDIA Quadro K600
    Primary Storage:
    INTEL SSDSC2CT180A4
    Secondary Storage:
    WDC WD2002FAEX-00MJRA0
    Monitor:
    2 X Dell 23"
    Discipline
    Surveying
    mk4176's Discipline Details
    Occupation
    Geodetic engineers and consultant
    Discipline
    Surveying
    Details
    IT and CAD management.
    Using
    AutoCAD 2014
    Join Date
    Jan 2018
    Location
    Israel
    Posts
    9

    Default Conditional visibility depending on Tag Value

    Hello,
    Any help is appreciated.
    I need to add to this code few conditions.

    I have a block (C1609) with the following Tags:

    LEGAL_LENGTH
    CALC_LENGTH
    CROSS

    1. I need to make LEGAL_LENGTH and CALC_LENGTH Visible if there is a "/" in CROSS.

    2. I need to make CALC_LENGTH visible if there is no value in LEGAL_LENGTH

    3. I need to make LEGAL_LENGTH visible and CALC_LENGTH invisible if there is no "/" in CROSS

    thanks in advance

    M.K.

  3. #13
    Senior Member
    Discipline
    Surveying
    dlanorh's Discipline Details
    Occupation
    Geospatial Engineer
    Discipline
    Surveying
    Using
    AutoCAD 2012
    Join Date
    Aug 2017
    Location
    UK/Bundesrepublik Deutschland
    Posts
    113

    Default

    What are the initial visibility states of the three attributes?
    If there is no value in LEGAL_LENGTH is it still visible?

  4. #14
    Forum Newbie
    Computer Details
    mk4176's Computer Details
    Operating System:
    Windows, QTS, DSM
    Computer:
    Dell Inc. OptiPlex 7010
    Motherboard:
    Dell Inc.
    CPU:
    Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
    RAM:
    16.0 GB
    Graphics:
    2 X NVIDIA Quadro K600
    Primary Storage:
    INTEL SSDSC2CT180A4
    Secondary Storage:
    WDC WD2002FAEX-00MJRA0
    Monitor:
    2 X Dell 23"
    Discipline
    Surveying
    mk4176's Discipline Details
    Occupation
    Geodetic engineers and consultant
    Discipline
    Surveying
    Details
    IT and CAD management.
    Using
    AutoCAD 2014
    Join Date
    Jan 2018
    Location
    Israel
    Posts
    9

    Default

    It doesn't matter, I want to run the lisp, depending on the condition, I want the final state.

  5. #15
    Junior Member
    Using
    AutoCAD 2016
    Join Date
    Apr 2016
    Posts
    16

    Default

    Instead of toggle On/Off, is it possible to have a few preset options to choose Tags combination (using getkword) visibility ON, eg. TAG1&TAG2, TAG2&TAG3, TAG1 only, TAG2 only and All ON?
    Thanks

  6. #16
    Forum Newbie
    Computer Details
    mk4176's Computer Details
    Operating System:
    Windows, QTS, DSM
    Computer:
    Dell Inc. OptiPlex 7010
    Motherboard:
    Dell Inc.
    CPU:
    Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
    RAM:
    16.0 GB
    Graphics:
    2 X NVIDIA Quadro K600
    Primary Storage:
    INTEL SSDSC2CT180A4
    Secondary Storage:
    WDC WD2002FAEX-00MJRA0
    Monitor:
    2 X Dell 23"
    Discipline
    Surveying
    mk4176's Discipline Details
    Occupation
    Geodetic engineers and consultant
    Discipline
    Surveying
    Details
    IT and CAD management.
    Using
    AutoCAD 2014
    Join Date
    Jan 2018
    Location
    Israel
    Posts
    9

    Default

    Maybe I should explain in another words.
    The drawing has a lot of block instances of block C1609 (Attached:C1609.dwg)
    If TAG "CROSS" has "/" in it, the other TAGS should be visible.
    If TAG "LEGAL_LENGTH" has any value, and no "/" in TAG "CROSS", TAG "CALCULATE_LENGTH" should be invisible.
    IF TAG "LEGAL_LENGTH" is empty, TAG "CALCULATED_LENGTH" should be visible, or the visibility state of TAG LEGAL_LENGTH doesn't matter because it's empty.
    It should be stated that not always there is a LEGAL_LENGTH value, but always there is CALCULATED_LENGTH value.
    The lisp should scan the drawing of any instances of block C1609 and modify the visibility state depending on the conditions in each instance.
    Thank you

  7. #17
    Senior Member
    Discipline
    Surveying
    dlanorh's Discipline Details
    Occupation
    Geospatial Engineer
    Discipline
    Surveying
    Using
    AutoCAD 2012
    Join Date
    Aug 2017
    Location
    UK/Bundesrepublik Deutschland
    Posts
    113

    Default

    OK, Try this. It has only been briefly tested on a block I constructed.
    Code:
    (vl-load-com)
    (defun C:test ( / *error* c_doc ss atts a_lst t_str)
    
      (defun *error* ( msg )
            (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
            (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nAn Error : " msg " occurred.")))
            (princ)
        );end_defun
        
        (setq c_doc (vla-get-activedocument (vlax-get-acad-object))
              ss (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "C1609")))
        );end_setq
    
        (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
        (vla-startundomark c_doc)
        
        (vlax-for blk (vla-get-activeselectionset c_doc)
        (setq a_lst nil
              atts (append (vlax-invoke blk 'GetAttributes) (vlax-invoke blk 'GetConstantAttributes))
        );end_setq
        (foreach att atts
          (setq a_lst (cons (cons (vlax-get-property att 'tagstring) (list att (vlax-get-property att 'textstring))) a_lst))
          (vlax-put-property att 'invisible :vlax-false)
        );end_foreach
        (setq t_str (cadr (cdr (assoc "CROSS" a_lst))))      
        (if (not (wcmatch t_str "*/*"))
          (vlax-put-property (car (cdr (assoc "CALC_LENGTH" a_lst))) 'invisible :vlax-true)
        );end_if         
      );_end vlax-for t_blk
        (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
    );end_defun

  8. #18
    Forum Newbie
    Computer Details
    mk4176's Computer Details
    Operating System:
    Windows, QTS, DSM
    Computer:
    Dell Inc. OptiPlex 7010
    Motherboard:
    Dell Inc.
    CPU:
    Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz, 3401 Mhz, 4 Core(s), 8 Logical Processor(s)
    RAM:
    16.0 GB
    Graphics:
    2 X NVIDIA Quadro K600
    Primary Storage:
    INTEL SSDSC2CT180A4
    Secondary Storage:
    WDC WD2002FAEX-00MJRA0
    Monitor:
    2 X Dell 23"
    Discipline
    Surveying
    mk4176's Discipline Details
    Occupation
    Geodetic engineers and consultant
    Discipline
    Surveying
    Details
    IT and CAD management.
    Using
    AutoCAD 2014
    Join Date
    Jan 2018
    Location
    Israel
    Posts
    9

    Default

    Thank you very much.
    First Case worked perfectly when there is a "/" in CROSS, both CLACULATED_LENGTH and LEGAL_LENGTH are on.
    Second Case did not work.
    It turned all CALCULATED_LENGTH off even if there is no "/" in CROSS or LEGAL_LENGTH is empty.
    Can you, please, fix that.

  9. #19
    Senior Member
    Discipline
    Surveying
    dlanorh's Discipline Details
    Occupation
    Geospatial Engineer
    Discipline
    Surveying
    Using
    AutoCAD 2012
    Join Date
    Aug 2017
    Location
    UK/Bundesrepublik Deutschland
    Posts
    113

    Default

    Post Removed
    Last edited by dlanorh; 14th Jun 2018 at 11:07 pm.

  10. #20
    Senior Member
    Discipline
    Surveying
    dlanorh's Discipline Details
    Occupation
    Geospatial Engineer
    Discipline
    Surveying
    Using
    AutoCAD 2012
    Join Date
    Aug 2017
    Location
    UK/Bundesrepublik Deutschland
    Posts
    113

    Default

    Registered forum members do not see this ad.

    OK I think this no works as you want it.


    Code:
    (vl-load-com)
    (defun C:test ( / *error* c_doc ss atts a_lst t_str l_val)
    
      (defun *error* ( msg )
        (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
        (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nAn Error : " msg " occurred.")))
        (princ)
      );end_defun
                
      (setq c_doc (vla-get-activedocument (vlax-get-acad-object))
            ss (ssget "_X" '((0 . "INSERT") (66 . 1) (2 . "C1609")))
      );end_setq
    
      (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
      (vla-startundomark c_doc)
                
      (vlax-for blk (vla-get-activeselectionset c_doc)
        (setq a_lst nil
              atts (append (vlax-invoke blk 'GetAttributes) (vlax-invoke blk 'GetConstantAttributes))
        );end_setq
        (foreach att atts
          (setq a_lst (cons (cons (vlax-get-property att 'tagstring) (list att (vlax-get-property att 'textstring))) a_lst))
          (vlax-put-property att 'invisible :vlax-false)
        );end_foreach
        (setq t_str (cadr (cdr (assoc "CROSS" a_lst)))
              l_val (strlen (cadr (cdr (assoc "LEGAL_LENGTH" a_lst))))
        );end_setq                    
        (if (and (not (vl-string-search "/" t_str)) (> l_val 0))
          (vlax-put-property (car (cdr (assoc "CALC_LENGTH" a_lst))) 'invisible :vlax-true)
        );end_if         
      );_end vlax-for t_blk
      (if (and c_doc (= 8 (logand 8 (getvar 'UNDOCTL)))) (vla-endundomark c_doc))
    );end_defun

Similar Threads

  1. Replies: 0
    Last Post: 2nd Apr 2009, 01:05 pm
  2. Toggle display color with LISP
    By Flores in forum AutoLISP, Visual LISP & DCL
    Replies: 21
    Last Post: 11th Nov 2008, 03:43 pm
  3. Is there a LISP to toggle layers?
    By Ste1978 in forum AutoLISP, Visual LISP & DCL
    Replies: 15
    Last Post: 18th Jul 2008, 01:54 pm
  4. Little help needed with visible/invisible lines
    By jay in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 19th Dec 2005, 10:42 pm
  5. ... Insert attribute information into specific Xcell Cells?
    By Pablo Ferral in forum AutoCAD General
    Replies: 3
    Last Post: 13th Apr 2005, 07:32 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