Author Topic: Pline distance reactor  (Read 3647 times)

0 Members and 1 Guest are viewing this topic.

matrix2005in

  • Guest
Pline distance reactor
« on: May 27, 2006, 10:28:12 AM »
hi there

does anyone know by clicking multiple polyline, label it with distance and if i stretch or change  length, it should update distance automatically and align with polyline...any lisp available for this??...we are using 2000i
thanks

mathew

LE

  • Guest
Re: Pline distance reactor
« Reply #1 on: May 27, 2006, 10:40:36 AM »
There is not a single one available as open-source that you could find on the net.

nivuahc

  • Guest
Re: Pline distance reactor
« Reply #2 on: May 27, 2006, 12:35:03 PM »
I would think a combination of XData and Reactors should do it for someone with the time to write such a routine, yeah?

matrix2005in

  • Guest
Re: Pline distance reactor
« Reply #3 on: May 28, 2006, 03:39:08 AM »
so here is the challenge..

write a lisp which can do the same i mentioned above..see writing normal lisp routines doesn't make sense so start writing ...something different :-)

matrix2005in

  • Guest
Re: Pline distance reactor
« Reply #4 on: May 29, 2006, 02:59:28 AM »
NO one??? out there?????/  :cry: :oops: :cry: :oops: :cry:

Serge J. Gianolla

  • Guest
Re: Pline distance reactor
« Reply #5 on: May 29, 2006, 03:53:33 AM »
NO one??? out there?????/  :cry: :oops: :cry: :oops: :cry:
Luis had a tool like that, I doubt it is free though! I haven't seen him for a while here, but search for LE and you'll find address to his site.

Alternatively, it is so easy to attach fields to lines, reading their angles and lengths. Tied with a little lisp to make text align with them is nothing. But you'd have to say bye bye to 2000i!! :wink:

Fatty

  • Guest
Re: Pline distance reactor
« Reply #6 on: May 29, 2006, 03:55:49 AM »
NO one??? out there?????/  :cry: :oops: :cry: :oops: :cry:


I think no need to use ractor for this cause
Easier way might be:
Menu->Insert->Field
then in dialog window select in Field category: Object
then in Object type box press button to select polyline
on screen
then in Properties popup list select: Length
and in the Format list choose what you need
then pick the starting or the ending point to add field
Voila!
Do not forget if you will stretch a polyline, the field
value will be changed after drawing regeneration only
(command "regen")

Or the same stuff but programmatically:

Code: [Select]
(defun C:PLB (/ acsp adoc label1 mtx pline_obj)
  (vl-load-com)
  (or adoc
      (setq adoc
     (vla-get-activedocument
       (vlax-get-acad-object)
     )
      )
  )
  (if (and
(= (getvar "tilemode") 0)
(= (getvar "cvport") 1)
      )
    (setq acsp (vla-get-paperspace adoc))
    (setq acsp (vla-get-modelspace adoc))
  )
  (setq pline_obj (vlax-ename->vla-object
    (car (entsel "\n  >> Select a polyline to labeling >>\n"))))
  (setq label1
(strcat
   "%<\\AcObjProp Object(%<\\_ObjId "
   (itoa (vla-get-objectid pline_obj))
   ">%).Length \\f \"%lu2\">%"
)
  )
  (setq mtx (vlax-invoke  acsp
      'AddMText
      (vlax-curve-getstartpoint  pline_obj)
      0.0
      label1
    )
  )

  (vl-catch-all-apply
    (function (lambda ()
(progn
  (vlax-release-object mtx)
  (vlax-release-object pline_obj)
)
      )
    )
  )
  (vla-regen adoc acactiveviewport)
  (princ)
)
(prompt "\n===========================\n")
(prompt "\n Type PLB to execute ...   ")
(prompt "\n===========================\n")
(princ)
;(C:PLB);debug only

Hth

Fatty

~'J'~
« Last Edit: May 29, 2006, 04:18:04 AM by Fatty »

kpblc

  • Bull Frog
  • Posts: 396
Re: Pline distance reactor
« Reply #7 on: May 29, 2006, 04:10:54 AM »
Code: [Select]
(if *vlr-obj*
  (progn
    (setq *vlr-obj* nil)
    (vlr-remove-all :vlr-miscellaneous-reactor)
    ) ;_ end of progn
  ) ;_ end of if
(if (not *vlr-obj*)
  (setq   *vlr-obj* (vlr-miscellaneous-reactor
          nil
          '((:vlr-pickfirstmodified . selchange))
          ) ;_ end of vlr-miscellaneous-reactor
   ) ;_ end of setq
  ) ;_ end of if
(defun selchange (reactor event / selset sum_len)
  (setq sum_len 0)
  (if (and (setq selset   (vla-get-pickfirstselectionset
           (vla-get-activedocument (vlax-get-acad-object))
           ) ;_ end of vla-get-PickfirstSelectionSet
       ) ;_ end of setq
      (> (vla-get-count selset) 0)
      ) ;_ end of and
    (progn
      (vlax-for   item selset
   (if (vlax-property-available-p item 'length)
     (setq sum_len (+ sum_len (vla-get-length item)))
     ) ;_ end of if
   ) ;_ end of vlax-for
      (setvar "modemacro" (rtos sum_len 2 4))
      ) ;_ end of progn
    (setvar "modemacro" ".")
    ) ;_ end of if
  ) ;_ end of defun
Code: [Select]
(if *vlr-obj*
  (progn
    (setq *vlr-obj* nil)
    (vlr-remove-all :vlr-miscellaneous-reactor)
    ) ;_ end of progn
  ) ;_ end of if
(if (not *vlr-obj*)
  (setq   *vlr-obj* (vlr-miscellaneous-reactor
          nil
          '((:vlr-pickfirstmodified . selchange))
          ) ;_ end of vlr-miscellaneous-reactor
   ) ;_ end of setq
  ) ;_ end of if
(defun selchange (reactor event / selset sum_len iten_name)
  (setq sum_len 0.0)
  (if (and (setq selset   (vla-get-pickfirstselectionset
           (vla-get-activedocument (vlax-get-acad-object))
           ) ;_ end of vla-get-PickfirstSelectionSet
       ) ;_ end of setq
      (> (vla-get-count selset) 0)
      ) ;_ end of and
    (progn
      (vlax-for   item selset
   (if (vlax-property-available-p item 'length)
     (setq sum_len (+ sum_len (vla-get-length item)))
     (setq   item_name (strcase (vla-get-objectname item) t)
      sum_len     (+ sum_len
              (cond
                ((= item_name "acdbcircle")
            (* 2 pi (vla-get-radius item))
            )
                ((= item_name "acdbarc")
            (vla-get-ArcLength item)
            )
                (t 0.0)
                ) ;_ end of cond
              ) ;_ end of +
      ) ;_ end of setq
     ) ;_ end of if
   ) ;_ end of vlax-for
      (setvar "modemacro" (rtos sum_len 2 4))
      ) ;_ end of progn
    (setvar "modemacro" ".")
    ) ;_ end of if
  ) ;_ end of defun
Source: http://dwg.ru/forum/viewtopic.php?t=7527
Sorry for my English.

Fatty

  • Guest
Re: Pline distance reactor
« Reply #8 on: May 29, 2006, 05:14:18 AM »
Слушай, убери свои извинения за английский,
тебе уже намекнули на это
(Из чисто дружеских побуждений)
Олег

kpblc

  • Bull Frog
  • Posts: 396
Re: Pline distance reactor
« Reply #9 on: May 29, 2006, 05:54:22 AM »
> Fatty : уболтал :)
Sorry for my English.

Fatty

  • Guest
Re: Pline distance reactor
« Reply #10 on: May 29, 2006, 07:08:21 AM »
> Fatty : уболтал :)
То-то мне! 8-)

matrix2005in

  • Guest
Re: Pline distance reactor
« Reply #11 on: May 29, 2006, 09:46:18 AM »
not resolving my issue........i gota  AutoCAD 2000i
 :-( :-( :cry: :cry:

LE

  • Guest
Re: Pline distance reactor
« Reply #12 on: May 29, 2006, 10:17:30 AM »
Hi Fatty,

Он использует AutoCAD 2000i

 :-)

Fatty

  • Guest
Re: Pline distance reactor
« Reply #13 on: May 29, 2006, 12:26:46 PM »
Hi Fatty,

Он использует AutoCAD 2000i

 :-)
Спасибо Роберт, я понял это с превеликим трудом :-D