Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

3Dclip in Lisp

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
753 Views, 3 Replies

3Dclip in Lisp

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
3 REPLIES 3
Message 2 of 4
ahsattarian3
in reply to: Anonymous

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
in reply to: ahsattarian3

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...

Message 4 of 4
marko_ribar
in reply to: juanraXSVE3

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)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost