Author Topic: CIRCLES IN A CURVE  (Read 2154 times)

0 Members and 1 Guest are viewing this topic.

sandrex

  • Guest
CIRCLES IN A CURVE
« on: February 29, 2012, 06:26:05 PM »
Hello forum, I'm new vlisp.
As I can do circles around a curve at different distances.
« Last Edit: March 01, 2012, 02:14:49 PM by sandrex »

danallen

  • Guest
Re: CIRCLES IN A CURVE
« Reply #1 on: February 29, 2012, 06:31:09 PM »
make a block of a circle, then use DIVIDE or MEASURE, and the "block" option

Dan

sandrex

  • Guest
Re: CIRCLES IN A CURVE
« Reply #2 on: February 29, 2012, 06:43:05 PM »
heló Dan.

An example please.

danallen

  • Guest
Re: CIRCLES IN A CURVE
« Reply #3 on: February 29, 2012, 07:50:35 PM »
draw a circle, type "BLOCK", select the circle and make it a block

draw your curve, is it a spline?

type DIVIDE, select your curve, type BLOCK, enter the name of your block, and finish the command options

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: CIRCLES IN A CURVE
« Reply #4 on: March 03, 2012, 01:04:54 AM »
If you've got ACad 2012 you can achieve the same through the new array command. It has an option to array along a path (any path: arc, polyline, spline, line, etc.). No need to first change the circle into a block. And you can adjust the spacing / number of array items by dragging grips / using the properties palette after the fact, no need to redo the divide/measure if you want a change.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: CIRCLES IN A CURVE
« Reply #5 on: March 03, 2012, 01:30:04 AM »
E.g. the old way would be to use the Divide / measure commands (see video capture). Also shown the new array command with path.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

fixo

  • Guest
Re: CIRCLES IN A CURVE
« Reply #6 on: March 03, 2012, 09:43:04 AM »
Hello forum, I'm new vlisp.
As I can do circles around a curve at different distances.

Found it in my code storage, se if this is working for you
Code: [Select]
;;------------------------------------ DIVC.LSP ----------------------------------;;

;; fixo () 2012 * all rights released
;; edited 3/3/12
;; used Nueva carpeta.dwg
(defun C:DIVC(/ *error* acsp adoc closed cnt curve en leng num oname p rad sset step)
 
    (defun *error* (msg)
      (vla-endundomark (vla-get-activedocument
              (vlax-get-acad-object))
      )
    (cond ((or (not msg)
       (member msg '("console break" "Function cancelled" "quit / exit abort"))
       )
   )
  ((princ (strcat "\nError: " msg)))
  )

    (princ)
    )
 
(setq adoc (vla-get-activedocument
              (vlax-get-acad-object))
      acsp (vla-get-block(vla-get-activelayout adoc)))
 

  (vla-startundomark adoc )
   
(while (not sset)
 
    (setq sset (ssget '((0 . "*LINE,ARC,ELLIPSE,ARC,CIRCLE")))
 
  )
  )
 
(initget 7)
 
(setq num (getint "\nNumber of circles? : ") )
 
(initget 7)
 
(setq rad (getdist "\nRadius ? : ") )
 
(while (setq en (ssname sset 0))

  (setq curve (vlax-ename->vla-object en))

  (setq oname (vla-get-objectname curve))

  (cond ((eq "AcDbArc" oname)
(setq leng (vla-get-arclength curve)))

((or (eq "AcDbEllipse" oname) (eq "AcDbSpline" oname))
(setq leng (vlax-curve-getdistatparam
      curve
      (vlax-curve-getendparam curve)))
(if (equal (vlax-curve-getendparam curve) (* pi 2) 0.0001)
   (setq closed T)
   (setq closed nil))
)
;;ellipse
((eq "AcDbCircle" oname)
(setq leng (vla-get-circumference curve))
(setq closed T)
)
((eq "AcDbLine" oname)
(setq leng (setq leng (vla-get-length curve)))
(setq closed nil)
)
((eq "AcDbPolyline" oname)
(progn
   (setq leng (vla-get-length curve))
   (if (eq :vlax-true
   (vl-catch-all-apply '(lambda () (vla-get-closed curve))))

     (setq closed T)
     (setq closed nil)))
))


  (setq step (if closed
       (/ leng num)
       (/ leng (1- num))))

  (setq cnt 0)

  (repeat num

    (setq p (vlax-curve-getpointatparam
      curve
      (vlax-curve-getparamatdist curve (* step cnt))))

    (vlax-invoke acsp 'addcircle p rad)

    (setq cnt (1+ cnt))
    )

  (ssdel en sset)

  )
 
  (*error* nil)
 
  (princ)
  )
(princ "\n\t---\tStart command with \"DIVC\"\t---")
(princ)
(or (vl-load-com)
    (princ))

~'J'~

trogg

  • Bull Frog
  • Posts: 255
Re: CIRCLES IN A CURVE
« Reply #7 on: March 03, 2012, 11:21:46 AM »
Don't forget Allan's code "Copy Along Curve"
http://www.theswamp.org/index.php?topic=32789.0