Jump to content

lisp to toggle a specific attribute visible/invisible


Astro

Recommended Posts

  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • Astro

    6

  • dlanorh

    6

  • mk4176

    6

  • Lee Mac

    4

Top Posters In This Topic

Posted Images

  • 2 weeks later...

There are many lisps to turn off an attribute, just by clicking on it.

Can Any one modify the am2 lisp, so turning on an attribute would happen by clicking on it, not by naming it in the lisp code?

I mean, when I pick a block, all the attributes with "off state" would be turned on, after clicking on one attribute, it stays on, and all others got back to "off" state.

I attached a video to demonstrate.

Any help is appreciated.

 

Edited by mk4176
Link to comment
Share on other sites

  • 5 years later...

Dears,

 

I have the same issue in the attached files. I shared two files: the original CAD file I got from processing software and the other one I should get. The original cad file has many blocks with three attribute tags( POINT_NUMBER, DESCRIPTION, and ELEVATION). I need Lisp or Routine first. I need to rename them as (Point, Code, and Height). Then, I need to select the bouch of the same block and choose any Tag to Hide or Unhide. Also, I need to change the Height of the text and rotate and align it with the line, polyline, or carve. I would be grateful if you could help me with this.

 

 

 

 

3026.dwg 3026-orginal.dwg

Link to comment
Share on other sites

I  seem to recall did the visibilty bit as a global routine pick a block and showed visibility in a toggle dcl showing on/off. Turning  all off attributes back to on can be done.  I will try to find.

 

Same idea with renaming tagnames, you can bedit the block definition just using Properties and change tagname, for 3 really its quick compared to writing code.

Edited by BIGAL
Link to comment
Share on other sites

Try this bit busy at moment version 2 would display current visibilty. Make sure you save Multi toggles in a search path or edit teh load to include full path.

 

(defun c:blkvisoff ( / x k ss obj lst lst2 atts att)
(setq blkname (cdr (assoc 2 (entget (car (entsel "\nPick a block for atts invisible "))))))
(setq ss (ssget "_X" '((0 . "INSERT") (cons 2 blkname)(66 . 1))))
(setq obj (vlax-ename->vla-object (ssname ss 0)))
(setq atts (vlax-invoke obj 'Getattributes))

(setq lst '())
(foreach att atts
  (setq lst (cons (vlax-get att 'tagstring) lst))
)

(setq lst (cons "Select toggle for on " lst))
(if (not AH:Toggs)(load "Multiple toggles.lsp"))
(setq ans (reverse (ah:toggs  (append '("Select toggle for on ") lst))))

(setq lst2 '())
(setq K 0)
(foreach tagn lst
  (setq lst2 (cons (list tagn (nth k ans)) lst2))
  (setq k (1+ k))
)

(repeat (setq x (sslength ss))
  (setq obj (vlax-ename->vla-object (ssname ss (setq x (1- x)))))
  (setq atts (vlax-invoke obj 'Getattributes))
  (foreach tagn lst2
  (setq k 0)
  (foreach att atts
    (if (= (car tagn) (vlax-get att 'tagstring))
    (progn
      (if (= (cadr tagn) "1")
        (princ "on")
        (vlax-put att 'invisible -1)
      )
      (setq k (1+ k))
    )
    )
  )
  )
)

(princ)
)

 

image.png.c6c7c8c66a1e0c7c4f2c1f136e9b5006.png

 

The issue of readability of points has been discussed so many times, 40+ years doing civil, rotating points to a line may be very difficult. You need to look at how the text blocks are made the 2nd attribute appears to be located on the line etc so I guess could get an angle of object at that point. It will definatley be a custom program compared to what I just supplied should work with any block with attributes.

 

So that is step1 done in about 4 steps. Anyone else happy if you add on.

Multi toggles.lsp

Edited by BIGAL
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...