Author Topic: Point cloud on/off toggle  (Read 1889 times)

0 Members and 1 Guest are viewing this topic.

Pad

  • Bull Frog
  • Posts: 342
Point cloud on/off toggle
« on: May 08, 2015, 05:09:52 AM »
Hi

I have a little lisp which will toggle a point cloud on/off by its layer.  The problem is that I am unable to lock the point cloud as if you do you are unable to apply clipping etc.  Because of this it is often selected and then accidentally has its layer changed.
Is there away of selecting the point cloud by its type instead of by its layer?

This is the lisp I currently use:
Code: [Select]
;;; http://forums.augi.com/showthread.php?17541-Toggle-Layer-ON-OFF

    (defun c:pcl() (c:pointcloudonoff))
(defun c:pointcloudonoff(/ lName lyr lyrCol)
  (setq lyrCol (vla-get-layers (vla-get-activeDocument (vlax-get-acad-object))))  ;;get the layer collection
  (setq lName  "0-Cloud")  ;;<-set the layer name here
  (if (vl-catch-all-error-p (setq lyr (vl-catch-all-apply 'vla-item (list lyrCol lName))))  ;;get specific layer object or error code
(princ)  ;;if error, do nothing
(if (= (vla-get-layerOn lyr) :vlax-true)  ;;if no error, check if layer is on
  (vla-put-layerOn lyr :vlax-false)  ;;if on, turn it off
  (vla-put-layerOn lyr :vlax-true)  ;;if off, turn it on
)
  )
  (princ)
)

Thanks

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Point cloud on/off toggle
« Reply #1 on: May 08, 2015, 05:15:32 AM »
I've not previously worked with point clouds - what is returned if you select the point cloud using the following code?
Code: [Select]
(defun c:test ( / e ) (if (setq e (car (entsel))) (print (cdr (assoc 0 (entget e))))) (princ))

Pad

  • Bull Frog
  • Posts: 342
Re: Point cloud on/off toggle
« Reply #2 on: May 08, 2015, 05:25:34 AM »
Hi Lee,

Command: (defun c:test ( / e ) (if (setq e (car (entsel))) (print (cdr (assoc 0 (entget e))))) (princ))
C:TEST
Command: TEST
Select object:
"ACDBPOINTCLOUDEX"
Command:

ymg

  • Guest
Re: Point cloud on/off toggle
« Reply #3 on: May 08, 2015, 05:55:57 AM »
Pad,

How about Freeze/Thaw instead of Off/On ?

This is what I do in Triang program.

Or following Lee's advice do (vlax-dump-object en t)
on the cloud and check the properties and methods
available for this object.

ymg
« Last Edit: May 08, 2015, 06:07:17 AM by ymg »