Toggle image display in Map 3D with Raster Tools

Toggle image display in Map 3D with Raster Tools

Anonymous
Not applicable
1,041 Views
4 Replies
Message 1 of 5

Toggle image display in Map 3D with Raster Tools

Anonymous
Not applicable

Hello,

 

I'm trying to create a command to toggle the display of images using the raster tool commands ISELECTALLINSERTIONS, IHIDEINSERTION, ISHOWINSERTION. 

 

With object order it is nice to turn it off quickly, modify linework, then turn it back on. If there is a better way other than the raster tools, I'm all ears. I'm novice at best with lisp.

 

What I thought would've worked... but doesn't:

 

(defun c:IMF ()
  (Command "ISELECTALLINSERTIONS" ""
	   "IHIDEINSERTION"
	   )
  )

(defun c: IMS ()
  (command "ISELECTALLINSERTIONS" ""
           "ISHOWINSERTION"
	   )
  )

 

Thank you!

 

 

 

0 Likes
Accepted solutions (1)
1,042 Views
4 Replies
Replies (4)
Message 2 of 5

CodeDing
Advisor
Advisor

@Anonymous ,

 

I don't deal with handling images in LISP too much, so let me know if this works for you or not:

(defun c:IMF ( / ss e cnt)
(if (setq ss (ssget "_X" '((0 . "IMAGE"))))
  (progn
    (repeat (setq cnt (sslength ss))
      (setq e (ssname ss (setq cnt (1- cnt))))
      (setpropertyvalue e "Visible" 1)
    );repeat
    (prompt "\nImages 'Frozen' successfully.")
  );progn
;else
  (prompt "\nNo images found...")
);if
(setq ss nil)
(princ)
);defun
(defun c:IMS ( / ss e cnt)
(if (setq ss (ssget "_X" '((0 . "IMAGE"))))
  (progn
    (repeat (setq cnt (sslength ss))
      (setq e (ssname ss (setq cnt (1- cnt))))
      (setpropertyvalue e "Visible" 0)
    );repeat
    (prompt "\nImages 'Thawed' successfully.")
  );progn
;else
  (prompt "\nNo images found...")
);if
(setq ss nil)
(princ)
);defun

Best,

~DD

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hi! 

It toggled them "off" - I couldn't see the frames though, of the images, they went away too. But I could get the images to turn back on unless I typed in undo. How 

0 Likes
Message 4 of 5

CodeDing
Advisor
Advisor
Accepted solution

@Anonymous ,

 

Well there were 2 functions provided. One to hide them and one to show them. You can use them both and should not have to use UNDO.

You said you were working with other linework so I used the visibility that hid the borders also.. If you would like to keep the borders then use these 2 functions instead..

NOTE: Be sure your IMAGEFRAME variable is set to either 1 or 2 to show the frame.

Also, if you would rather, these can be combined into ONE function asking for ON / OFF if you would prefer?

(defun c:IMF ( / ss e cnt)
(if (setq ss (ssget "_X" '((0 . "IMAGE"))))
  (progn
    (repeat (setq cnt (sslength ss))
      (setq e (ssname ss (setq cnt (1- cnt))))
      (setpropertyvalue e "ShowImage" 0)
    );repeat
    (prompt "\nImages 'Frozen' successfully.")
  );progn
;else
  (prompt "\nNo images found...")
);if
(setq ss nil)
(princ)
);defun
(defun c:IMS ( / ss e cnt)
(if (setq ss (ssget "_X" '((0 . "IMAGE"))))
  (progn
    (repeat (setq cnt (sslength ss))
      (setq e (ssname ss (setq cnt (1- cnt))))
      (setpropertyvalue e "ShowImage" 1)
    );repeat
    (prompt "\nImages 'Thawed' successfully.")
  );progn
;else
  (prompt "\nNo images found...")
);if
(setq ss nil)
(princ)
);defun

Best,

~DD

Message 5 of 5

Anonymous
Not applicable

Oh! I'm sorry - I inadvertently looked over that piece! Yep - they both work! They you soooo much! I think you helped me before, too, with the Polygons. 

Truly appreciated!

0 Likes