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

How get lisp variable (point) in vb.net ?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
ButterFlyShame
1023 Views, 2 Replies

How get lisp variable (point) in vb.net ?

Hello there. I found below lisp in internet. What is does is , It will find the bounding box of selected object and it put those data in minpoint and maxpoint variable and show them in command prompt.

with this format ( x1 y1 z1 , x2  y2 z2)

I believe , right term is " Buffer ".

 

Now my question is , how can I can read  X,Y

coordinates of those point in  vb net.

 

Or at least write them in a file.

I nice example would be helpful because I am not a pro.

Thanks for all help.

 

;;=============================

(defun C:minmax()
(setq BarEname (cdr (car (entget (car (entsel "\nselect your object "))))))
(ucs-bbox BarEname)
)

 

;; can be used with vla-transformby to
;; transform objects from the UCS to the WCS
(defun UCS2WCSMatrix ()
(vlax-tmatrix
  (append
    (mapcar '(lambda (vector origin) (append (trans vector 1 0 t) (list origin)) )
              (list '(1 0 0) '(0 1 0) '(0 0 1))
              (trans '(0 0 0) 0 1) )
    (list '(0 0 0 1))
    )
  )
)

;; transform objects from the WCS to the UCS
(defun WCS2UCSMatrix ()
  (vlax-tmatrix
    (append
      (mapcar '(lambda (vector origin)(append (trans vector 0 1 t) (list origin)))
               (list '(1 0 0) '(0 1 0) '(0 0 1))
               (trans '(0 0 0) 1 0)
               )
      (list '(0 0 0 1))
      )
    )
)

;; Returns the UCS coordinates of the object bounding box about UCS
;; Argument
;;   obj : a graphical object (ename or vla-object)
;; Return
;;   a list of left lower point and right upper point UCS coordinates
(defun ucs-bbox (obj / minpoint maxpoint)
  (vl-load-com)
  (and (= (type obj) 'ENAME)
       (setq obj (vlax-ename->vla-object obj))
       )
  (vla-TransformBy obj (UCS2WCSMatrix))
  (vla-getboundingbox obj 'minpoint 'maxpoint)
  (vla-TransformBy obj (WCS2UCSMatrix))
  (list (vlax-safearray->list minpoint)
        (vlax-safearray->list maxpoint)
        )
)

2 REPLIES 2
Message 2 of 3
JustoAg
in reply to: ButterFlyShame

You may try this approach:

 

(defun C:minmax ()

   (setq BarEname (cdr (car (entget (car (entsel "\nselect your object "))))))

   (setq pointList (ucs-bbox BarEname))

   (setq f (open "AFile.tmp" "w"))

   (print pointList f)

   (close f)

  (princ)

)

 

Now, parse and read this file from vb.net. Deleted it when finished.

 

Hope this helps.

 

Justo Aguiar

Message 3 of 3
ButterFlyShame
in reply to: JustoAg

Hello JustoAg,

Your Code worked Perfect. Thanks,

Thanks again. I am so happy with this site and proffesional people who signed in.

 

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

Post to forums  

”Boost