Jump to content
benhubel

Segment Curve with curves

Recommended Posts

benhubel

The Segment Curve LISP is insanely useful for simplifying superfluous geometry. It splits a curve into a user defined number of lines.

Currently I just follow Segment Curve with PEdit Fit to turn them back into curves. The problem is that this method adds lots of unnecessary curves back in and isn't very clean, so its usefulness has a limit.

 

I am wondering if instead of splitting into lines, it might be modified to split the curve into a user defined number of curves to follow the original one?

 

Alternately, if there are other ways to simplify geometry that I didn't know about (especially ones that will preserve corners) I am open to those ideas as well.

Share this post


Link to post
Share on other sites
BIGAL

This is an old one I had

 

; Converts 1 arc to multi arc

; By Alan H
(vl-load-com)

(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(setq oldlayer (getvar "clayer"))

;pdmode point type use when checking points
; (setvar "pdmode" 34)

(setvar "osmode" 512)  ; nearest make sure on line
(setq pickobj (entsel "\nPick arc :"))
(setq obj1 (vlax-ename->vla-object (car pickobj)))
(setq pickpt (cadr pickobj))  
(setvar "clayer" (cdr (assoc 8 (entget (car pickobj)))))

(setq cenpt1 (cdr (assoc 10 (entget (car pickobj)))))
(setq rad (cdr (assoc 40 (entget (car pickobj)))))

(setq ang1 (cdr (assoc 50 (entget (car pickobj)))))
(setq ang2 (cdr (assoc 51 (entget (car pickobj)))))

(setq howmany (getreal "\nEnter how many sections required "))
(setq ang (/ (- ang2 ang1) howmany))
(setq pt1 (polar cenpt1 ang1 rad))

(entdel (car pickobj))

(setq x (fix howmany))  ; doesn't like reals in repeat
(repeat x
(setq ang2 (+ ang ang1))
(setq pt2 (polar cenpt1 ang2 rad))
(command "arc" pt1 "e" pt2 "r" rad)
(setq pt1 pt2)
(setq ang1 ang2)
)

(setvar "osmode" oldsnap)
(princ)

Share this post


Link to post
Share on other sites
benhubel

Thank you, BIGAL. This solves half of my problem.

The other half is that I want to use it on a polyline containing multiple arcs and lines. I can't figure out an algorithm that will combine this with what Segment Curve does to a polyline.

Share this post


Link to post
Share on other sites
marko_ribar
Thank you, BIGAL. This solves half of my problem.

The other half is that I want to use it on a polyline containing multiple arcs and lines. I can't figure out an algorithm that will combine this with what Segment Curve does to a polyline.

 

At first I thought you're searching answer for SPLINE entities... Maybe this can help :

http://www.cadtutor.net/forum/showthread.php?96309-cut-line-into-equal-parts&p=#5

 

(worth is reading complete topic...)

 

HTH, M.R.

Share this post


Link to post
Share on other sites
benhubel

This definitely looks helpful. I'll check it out once I get the chance.

I love splines for drawing, but I almost always stay away from them if I can because I'm working with CNC machines, and AutoCAD 2004 doesn't flatten splines very gracefully. If I could get them to flatten with a perfectly clean result I'd probably use them more often.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...