LISP

리습 2016. 12. 15. 09:00

 (defun c:ee1 (/ )

  (setq BlockObjs (vla-get-Blocks (vla-get-activedocument (vlax-get-acad-object))))

  (vlax-for it BlockObjs

   (princ (vla-get-name it))

   (vla-item BlockObjs (vla-get-name it))

  )

)

블럭이름가져와서 비교

(if

(vl-catch-all-error-p(setq name(vl-catch-all-apply 'vla-item (list (vla-get-Blocks AcDoc) (vla-get-name s)))))

(setq name(cdr(assoc 2(entget(vlax-vla-object->ename s)))))

(setq name(vla-get-name s))

)




o1 = a

o2 = 1 , 2 , 3 입니다


(vlax-invoke o1 'intersectwith o2 acextendnon) 여깃에서 o2 에 "3" 이라면 응답값은 nil 이나옵니다 

    (acExtendOtherEntity 이것을 넣는다면 3이연장이 되어서 선이 잘라지긴하지만...)

그래서 

(vlax-curve-getdistatpoint o1 

                 (vlax-invoke o1 'intersectwith o2 acextendnon)

        )

이값이 error 이 되는건데.  이걸어떻게 해결해야할까요??


(vlax-curve-getdistatpoint o1 nil) 일경우 그냥 무시하여라.. 라는 것을 만들거나 아니면

 (vl-catch-all-error-p 이것을 써서 (error 가났을경우 T 응답하므로..) 

하면 될거같다는 생각을 해봤는데 도저히 감이 안잡혀서 이렇게 질문을 드립니다




if를 써서

(if (setq point (vlax-invoke o1 'intersectwith o2 acextendnon))

(setq dis (vlax-curve-getdistatpoint o1 point))... 

이런식으로 하면 되지 않나요?


(mapcar

'(lambda ( o2 / l )

(and

(setq l (vlax-invoke o1 'intersectwith o2 acextendnon))

(setq l (vlax-curve-getdistatpoint o1 l))

(setq lst (cons l lst))

)

)

os2

)



     

        (PTE:matchproperty obj1 obj2 

            (list 'color 'layer 'stylename 'height 'ObliqueAngle 'Rotation 'TextString)

        )





    ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-;;

    (defun PTE:matchproperty ( obj1 obj2 lst )

        (foreach property lst

            (and 

                (vlax-property-available-p obj1 property)

                (vlax-property-available-p obj2 property)

                (vlax-put-property obj2 property (vlax-get-property obj1 property))

            )

        )

    )




   ;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-;;

    (defun PTE:ss->obj ( ss / i re )

        (if ss

            (repeat (setq i (sslength ss))

                (setq re (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) re))

            )

        )

    )


    (defun PTE:Text (pt str ag siz ang)

        (setq obj 

            (vla-addtext 

                (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))

                str (vlax-3d-point (trans pt 1 0)) siz

            )

        )

        (vla-put-Alignment obj ag) ;10중간 9 왼쪽

        (vla-put-TextAlignmentPoint obj (vlax-3d-point pt))

        (vla-put-rotation obj ang)

        obj

    )




;(while (not (vl-catch-all-apply 'vla-GetSubEntity (list (vla-get-Utility (active-document)) 'vlaObject 'PickedPoint 

;(setq vlaOffsetPoint (vl-catch-all-apply 'vla-GetPoint (list (vla-get-Utility (active-document)) nil "Specify point on side to offset: ")))

;(princ vlaOffsetPoint)  (vlax-3d-point spt)

 (setq spt (upoint 1 "" "방향" nil (vlax-safearray->list PickedPoint)))


(command "offset" tdist  (handent (vla-get-Handle vlaObject)) spt "")

(command "offset" tdist (vlax-vla-object->ename vlaObject) spt "")




(vla-get-textstring y)

(vla-put-TextString obj2 len@ )



(setq obj (vlax-ename->vla-object (car (entsel))))

(setq obj(vlax-ename->vla-object (handent txtup_ss_handle)))


obj (vlax-ename->vla-object (entlast)) 

bb  (vla-get-Handle obj2)

obj (vlax-ename->vla-object (ssname ss i) 

obj (vlax-ename->vla-object a)

(vla-getboundingbox obj 'mi 'mx)

(setq   minpt (vlax-safearray->list mi)

maxpt (vlax-safearray->list mx)



objname (vla-get-objectname  obj))

area@   (vla-get-area obj)



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

(setq s1 (entlast))


(vla-GetBoundingBox (vlax-ename->vla-object sss) 'MinPt 'MaxPt) 

(vla-GetBoundingBox (vlax-ename->vla-object s1) 'MinPt 'MaxPt) 

 

  (setq pt1 (vlax-safearray->list MinPt)) 

  (setq pt3 (vlax-safearray->list MaxPt)) 



(setq elist (entget s1) intype (cdr (assoc 0 elist)) )


ent (entget (entlast))))) 

ent (entget a)


s1   (handent "29B" )


ent (entget s1)


bln (cdr (assoc  2 ent))

pt0 (cdr (assoc 10 ent))

xys (cdr (assoc 41 ent))

ang (cdr (assoc 50 ent))


bb  (cdr (assoc 5 (entget (entlast))))  ;;handel



 dum (cdr (assoc 5 ent)))

(setq a (ssname ss i) 


layer@  (cdr (assoc 8 (entget a))))

ent0    (cdr (assoc 0 (entget a))))








;;update용 소스 2016 저장값

(setq cdfn (getvar "dwgname") cnfl (strlen cdfn) cnl (- cnfl 4) cdn (substr cdfn 1 cnl) )

(setq fn99 (strcat #path_Project# cdn "_UP.txt"))



    (princ "계산식(들)을 선택하세요")

    (setq ss(PTE:ss->obj(ssget '((0 . "TEXT,MTEXT"))))

          px(car(getpoint "\n답(들)을 입력할 위치를 선택하세요"))

          dz(getvar 'dimzin)

    )

    (setvar 'dimzin 0)


        

        (PTE:matchproperty obj1 obj2 

           (list 'color 'layer 'stylename 'height 'ObliqueAngle 'Rotation 'TextString)


;;update용 소스 2016

(@e2c_write fn99 (strcat "CAL2|" (Itoa dot2) "| (vla-get-Handle obj2) "|" "_" "|""_"  "|" (vla-get-Handle obj1) "|" ))



(defun c:mixtext(/ mixtext1 mixtext2 mixtext3)

 (vl-load-com)

 (setvar "CMDECHO" 0)

 

 (prompt "\n첫번째 글자 선택 : ")

 (setq mixtext1 (vlax-ename->vla-object (ssname (ssget ":E:S" (list (cons 0 "TEXT"))) 0)))

 (prompt "\n두번째 글자 선택 : ")

 (setq mixtext2 (vlax-ename->vla-object (ssname (ssget ":E:S" (list (cons 0 "TEXT"))) 0)))

 (prompt "\n바꿀 글자 선택 : ")

 (setq mixtext3 (vlax-ename->vla-object (ssname (ssget ":E:S" (list (cons 0 "TEXT"))) 0)))

 

 (vla-put-TextString mixtext3 (strcat (vla-get-TextString mixtext1) " " (vla-get-TextString mixtext2)))

 (vla-delete mixtext1)

 (vla-delete mixtext2)

(princ)

)


'리습' 카테고리의 다른 글

line 이동하거나 신설하기  (0) 2018.01.03
Vlax-Curve 함수  (0) 2017.11.05
리액터  (0) 2017.03.30
AREA  (0) 2017.03.30
++_사칙연산연동2017 (reactor)  (0) 2017.03.30