Author Topic: math, geometric help needed  (Read 1724 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
math, geometric help needed
« on: January 26, 2010, 11:22:37 AM »
Hello there,

i have a geometric problem, i have, some lamps with a certain cable length and need to conetc to one centre connector, how can i find with lisp that hatched area (see example)

Thanks,

Bernd

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: math, geometric help needed
« Reply #1 on: January 26, 2010, 11:59:57 AM »
Hi,

Do you really want to do it programmatically ?
You can avoid it using the REGION command, select all circles, then INTERSECT command and select the regions.
Speaking English as a French Frog

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: math, geometric help needed
« Reply #2 on: January 26, 2010, 12:16:29 PM »
Here's a LISP which uses this method

<Edit: corrected missing astrerisk>
Code: [Select]
(defun c:minters (/ ss clst rlst)
  (vl-load-com)
  (or *acad* (setq *acad* (vlax-get-acad-object)))
  (or *acdoc* (setq *acdoc* (vla-get-ActiveDocument *acad*)))
  (if (ssget '((0 . "CIRCLE")))
    (progn
      (vlax-for c (setq ss (vla-get-ActiveSelectionSet *acdoc*))
(setq clst (cons c clst))
      )
      (vla-delete ss)
      (setq space (if (= 1 (getvar 'cvport))
    (vla-get-PaperSpace *acdoc*)
    (vla-get-ModelSpace *acdoc*)
  )
      )
      (setq rlst (vlax-invoke space 'AddRegion clst))
      (setq reg (car rlst)
    rlst (cdr rlst)
      )
      (while rlst
(vla-Boolean reg acIntersection (car rlst))
(setq rlst (cdr rlst))
      )
      (if (< 0.0 (vla-get-Area reg))
(progn
  (setq hatch (vla-AddHatch
space
acHatchPatternTypePredefined
"ANSI31"
:vlax-false
0
      )
  )
  (vlax-invoke hatch 'AppendOuterLoop (list reg))
  (vla-delete reg)
)
      )
    )
  )
  (princ)
)
« Last Edit: January 27, 2010, 01:16:49 PM by gile »
Speaking English as a French Frog

Amsterdammed

  • Guest
Re: math, geometric help needed
« Reply #3 on: January 26, 2010, 02:55:55 PM »
Thanks
I guess you are right, that is a good idea. I Will try it.

Bernd

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: math, geometric help needed
« Reply #4 on: January 27, 2010, 07:59:06 AM »
Gile,

I think you missed an asterisk  :wink:

Code: [Select]
(or *acad* (setq *acad[color=blue]*[/color] (vlax-get-acad-object)))


gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: math, geometric help needed
« Reply #5 on: January 27, 2010, 01:15:52 PM »
Right  :oops:
Speaking English as a French Frog

Lerner

  • Newt
  • Posts: 33
Re: math, geometric help needed
« Reply #6 on: January 29, 2010, 06:41:00 AM »
I must be missing something here. Can't this be done by picking one point with the standard hatch command?