3Dclip in Lisp

3Dclip in Lisp

Anonymous
Not applicable
849 Views
3 Replies
Message 1 of 4

3Dclip in Lisp

Anonymous
Not applicable
Hi, Does anyone know how to set (position & on/off) the front and rear clipping planes in AutoLisp? I am trying to set up a construction plane tool.

Many Thanks,

Cameron
850 Views
3 Replies
Replies (3)
Message 2 of 4

ahsattarian3
Enthusiast
Enthusiast

Hello Dear

These must solve your problem : 

 

(command "3dclip")
(command "dview" "all" "" "clip" "back")
(command "dview" "all" "" "clip" "front")
(command "dview" "all" "" "clip" "off" "")

Message 3 of 4

juanraXSVE3
Participant
Participant

Thanks man. This is very useful.

But do you know what property changes in the viewport and how to get or set it? I always try to program without "command" in the code...

0 Likes
Message 4 of 4

marko_ribar
Advisor
Advisor

I suppose you're looking for something within those lines :

 

(defun c:setupviewclip ( / ct vs vd sz v vx )
  (setq ct (getvar (quote viewctr)))
  (setq vs (getvar (quote viewsize)))
  (setq vd (getvar (quote viewdir)))
  (setq sz (getvar (quote screensize)))
  (if (not (tblsearch "VIEW" "{tmp}"))
    (setq v
      (entmakex
        (list
          (cons 0 "VIEW")
          (cons 100 "AcDbSymbolTableRecord")
          (cons 100 "AcDbViewTableRecord")
          (cons 2 "{tmp}")
          (cons 70 0)
          (cons 40 vs)
          (list 10 0.0 0.0 0.0)
          (cons 41 (* vs (apply (function /) sz)))
          (list 11 0.0 0.0 1.0)
          (list 12 0.0 0.0 0.0)
          (cons 42 (getvar (quote lenslength)))
          (cons 43 0.0)
          (cons 44 0.0)
          (cons 50 0.0)
          (cons 71 (getvar (quote viewmode)))
          (cons 281 0)
          (cons 72 0)
          (cons 73 0)
        )
      )
    )
    (setq v (tblobjname "VIEW" "{tmp}"))
  )
  (setq vx (tblsearch "VIEW" "{tmp}"))
  (setq vx (subst (cons 11 vd) (assoc 11 vx) vx))
  (setq vx (subst (cons 12 ct) (assoc 12 vx) vx))
  (setq vx (subst (cons 40 vs) (assoc 40 vx) vx))
  (setq vx (subst (cons 41 (* vs (apply (function /) sz))) (assoc 41 vx) vx))

;; change here you desire vvv ;;
  (setq vx (subst (cons 42 (getvar (quote lenslength))) (assoc 42 vx) vx))
  (setq vx (subst (cons 43 (getvar (quote frontz))) (assoc 43 vx) vx))
  (setq vx (subst (cons 44 (getvar (quote backz))) (assoc 44 vx) vx))
  (setq vx (subst (cons 50 (getvar (quote viewtwist))) (assoc 50 vx) vx))
  (setq vx (subst (cons 71 (getvar (quote viewmode))) (assoc 71 vx) vx))
;; end of comment ;;

  (setview vx)
  (princ)
)

HTH., M.R.

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes