Jump to content

Divide then Break/Split


VisDak

Recommended Posts

Good day,

 

I'm searching for a program that will divide and it will break or split intersecting hte points the line or polyline.

this will used to capture coordinates points on an arc area to make it easy to get X and Y point for an arc :)

 

 

Thanks for Help

Coordinates Points.GIF

Link to comment
Share on other sites

2 hours ago, VisDak said:

Good day,

 

I'm searching for a program that will divide and it will break or split intersecting hte points the line or polyline.

this will used to capture coordinates points on an arc area to make it easy to get X and Y point for an arc :)

 

 

Thanks for Help

Coordinates Points.GIF

 

Obtaining coordinates of points on a line, polyline or arc  is possible without dividing or breaking any of the objects using vlax-curve functions and a supplied number of points.

 

Try this. You will have to set PDMODE yourself.

 

(vl-load-com)

(defun c:pts2arc ( / *error* c_doc c_spc div sel ent pt typ c_pt s_d s_p e_d d_d isbulge)

  (defun *error* ( msg )
    (if (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nOops an Error : " msg " occurred.")))
    (princ)
  );_end_*error*_defun

  (setq c_doc (vla-get-activedocument (vlax-get-acad-object))
        c_spc (vlax-get-property c_doc (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
  );end_setq
  
  (initget 7)
  (setq div (getint "\nNumber of Points on Arc : "))
  
  (while (setq sel (entsel "\nSelect Arc : "))
    (mapcar 'set '(ent pt) sel)
    (setq typ (cdr (assoc 0 (entget ent))))
    
    (if (wcmatch typ "*POLYLINE") (setq obj (vlax-ename->vla-object ent)) (setq obj nil))
    
    (cond ( (wcmatch typ "*POLYLINE")
            (setq c_pt (vlax-curve-getclosestpointto ent pt)
                  s_d (vlax-curve-getdistatparam ent (setq s_p (fix (vlax-curve-getparamatpoint ent c_pt))))
                  e_d (vlax-curve-getdistatparam ent (1+ s_p))
                  d_d (/ (- e_d s_d) (1- div))
                  isbulge (if (/= 0.0 (vla-getbulge obj s_p)) T nil)
            );end_setq
          )
          ( (= typ "ARC")
            (setq s_d 0.0
                  d_d (/ (getpropertyvalue ent "Length") (1- div))
            );end_setq
          )
    );end_cond
    (cond ( (or (= typ "ARC") isbulge)
            (repeat div
              (vla-addpoint c_spc (vlax-3d-point (vlax-curve-getpointatdist ent s_d)))
              (setq s_d (+ s_d d_d))
            );end_repeat
          )
          ( (alert "Not an Arc"))
    );end_cond
  );end_while
);end_defun

 

Edited by dlanorh
clarity
Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...