Author Topic: Program testing of dangles  (Read 2135 times)

0 Members and 1 Guest are viewing this topic.

bprabhakar001

  • Guest
Program testing of dangles
« on: October 04, 2006, 09:12:43 AM »
Dear All,

I have needed to verify some of layers in the dwg are having nodes at both ends or not.
For that I have written program. But it is not fulfilling my needs completely. Would you please guide me where am I was committed mistake.


Code: [Select]
(defun c:ski_node
       (/ sel_set ename source_obj StPt EndPt ST_ST END_ET)
  (setq doc (vla-get-activedocument (vlax-get-acad-object)))
  (setq space
(if (zerop (vla-get-activespace doc))
   (if (= (vla-get-mspace doc) :vlax-true)
     (vla-get-modelspace doc) ; active VP
     (vla-get-paperspace doc)
   )
   (vla-get-modelspace doc)
)
  )

  (if (setq sel_set (ssget '((0 . "*line") (8 . "*AQ010"))))
    (progn
      (setq i -1)
      (while (setq ename (ssname sel_set (setq i (1+ i))))
(setq source_obj (vlax-ename->vla-object ename))
(setq StPt (vlax-curve-getStartPoint source_obj))
(command "zoom" "c" stpt "0.002")
(if (SETQ ST_ST (SSGET "C" STPT STPT '((0 . "POINT"))))
  (progn
    (setq EndPt (vlax-curve-getEndPoint source_obj))
    (command "zoom" "c" EndPt "0.002")
    (cond
      ((= nil
  (SETQ END_ET (SSGET "C" EndPt EndPt '((0 . "POINT"))))
       )
       (vla-addCircle Space (vlax-3d-point EndPt) 0.006)
      )
    )
  )
  (vla-addCircle Space (vlax-3d-point stpt) 0.006)
) ;if
      ) ;while
      (if (setq ss_cir (SSGET "X" '((0 . "circle"))))
(progn (setq no_cir (rtos (sslength ss_cir) 2 0))
       (setq err (strcat no_cir " ...errors found"))
)
      )
      (command "zoom" "e" "")
      (princ err)
    ) ;progn
  ) ;if
)

Thanking you,
Prabhakar.B



<edit: code tags>
« Last Edit: October 04, 2006, 09:18:20 AM by CAB »

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Program testing of dangles
« Reply #1 on: October 04, 2006, 09:47:19 AM »
Dear All,

I have needed to verify some of layers in the dwg are having nodes at both ends or not.
For that I have written program. But it is not fulfilling my needs completely. Would you please guide me where am I was committed mistake.
:-)
Code: [Select]
(defun c:ski_node (/ ss)
  ;(c:ski_node)
  (if (setq ss (ssget '((0 . "*line") (8 . "*AQ010"))))
    (princ
      (strcat
        "\n"
        (itoa
          (length
            (mapcar
              (function
                (lambda (x)
                  (if (null (ssget "_X" (list '(0 . "POINT,CIRCLE") (cons 10 x))))
                    (entmakex
                      (list
                        '(0 . "CIRCLE")
                        (cons 10 x)
                        '(40 . 0.006)
                      ) ;_  list
                    ) ;_  entmakex
                  ) ;_  if
                ) ;_  lambda
              ) ;_  function
              (apply (function append)
                     (mapcar
                       (function
                         (lambda (x)
                           (list
                             (vlax-curve-getStartPoint x)
                             (vlax-curve-getEndPoint x)
                           ) ;_  list
                         ) ;_  lambda
                       ) ;_  function
                       (vl-remove-if
                         (function listp)
                         (mapcar (function cadr) (ssnamex ss))
                       ) ;_  vl-remove-if
                     ) ;_  mapcar
              ) ;_  apply
            ) ;_  mapcar
          ) ;_  length
        ) ;_  itoa
        " ...errors found"
      ) ;_  strcat
    ) ;_  princ
  ) ;_  if
  (princ)
)

bprabhakar001

  • Guest
Re: Program testing of dangles
« Reply #2 on: October 05, 2006, 08:53:51 AM »
Thank you very much friend,

Really wonderfull,I am unablle to getting you,
When I compared to my code with u.I am afriad.
Would you please suggest me how do you preare a code.Intially are you preparing any flow chart or else.

Thanking you,
Prabhakar.B

ElpanovEvgeniy

  • Water Moccasin
  • Posts: 1569
  • Moscow (Russia)
Re: Program testing of dangles
« Reply #3 on: October 05, 2006, 09:06:10 AM »

Would you please suggest me how do you preare a code.Intially are you preparing any flow chart or else.

I think a little, then at once I write the code, then it I check on errors...