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

Need help to mod this lisp to draw line to object instead of zoom to.

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

Need help to mod this lisp to draw line to object instead of zoom to.

Hi.

I could have figure this one out if its in autolisp.

This lisp was from Tim Wiley which find a piece of string then zoom to it.

Is anyone able to modify this lisp to drawing a LINE from 0,0 to the object instead of zooming into object.

I tried (setq ObjOrigin (vla-get-Origin Obj)) and it doesn't work.



(defun c:Test (/ Str ObjType)



(vl-load-com)

(defun ZoomTo (Obj)



(command "_.zoom" "_object" (vlax-vla-object->ename Obj) "")

(while (/= (getstring "\n Press enter to proceed to next object: ") ""))

)

;--------------------------------------------

(if (/= (setq Str (getstring "\n Enter text to find: ")) "")

(vlax-for Obj (vla-get-Block (vla-get-ActiveLayout (vla-get-ActiveDocument

(vlax-get-Acad-Object))))

(setq ObjType (vla-get-ObjectName Obj))

(cond

((and (or (= ObjType "AcDbText") (= ObjType "AcDbMText")) (= Str

(vla-get-TextString Obj)))

(ZoomTo Obj)

)

((= ObjType "AcDbBlockReference")

(foreach Att (vlax-invoke Obj 'GetAttributes)

(if (= (vla-get-TextString Att) Str)

(ZoomTo Att)

)

)

)

)

)

)

(princ)

)



Thankyou and happy new year.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

(setq ent (vlax-vla-object->ename Obj) )
(setq p1 (cdr (assoc 10 ent)))
(command "line" '(0 0 0) p1 "")


wrote in message news:6096123@discussion.autodesk.com...
Hi.

I could have figure this one out if its in autolisp.

This lisp was from Tim Wiley which find a piece of string then zoom to it.

Is anyone able to modify this lisp to drawing a LINE from 0,0 to the object
instead of zooming into object.

I tried (setq ObjOrigin (vla-get-Origin Obj)) and it doesn't work.



(defun c:Test (/ Str ObjType)



(vl-load-com)

(defun ZoomTo (Obj)



(command "_.zoom" "_object" (vlax-vla-object->ename Obj) "")

(while (/= (getstring "\n Press enter to proceed to next object: ") ""))

)

;--------------------------------------------

(if (/= (setq Str (getstring "\n Enter text to find: ")) "")

(vlax-for Obj (vla-get-Block (vla-get-ActiveLayout (vla-get-ActiveDocument

(vlax-get-Acad-Object))))

(setq ObjType (vla-get-ObjectName Obj))

(cond

((and (or (= ObjType "AcDbText") (= ObjType "AcDbMText")) (= Str

(vla-get-TextString Obj)))

(ZoomTo Obj)

)

((= ObjType "AcDbBlockReference")

(foreach Att (vlax-invoke Obj 'GetAttributes)

(if (= (vla-get-TextString Att) Str)

(ZoomTo Att)

)

)

)

)

)

)

(princ)

)



Thankyou and happy new year.
Message 3 of 4
devitg
in reply to: Anonymous

Give it a try
Message 4 of 4
Anonymous
in reply to: Anonymous

Thankyou



Exactly what i wanted.

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

Post to forums  

Autodesk Design & Make Report

”Boost