Jump to content

Recommended Posts

Posted (edited)

Hi everyone, please help me lisp cut pline, please see the uploaded file. Thank so much.

image.thumb.png.9a847490ef174d21139a26a3501d3932.png

test1.dwg

Edited by vandehuy
Posted

If its steel reinforcement are you sure you can get > 11700 lengths ? say a 12m long bar ? Been a while since I did steel reo.

Posted
18 hours ago, devitg said:

@vandehuy how to know distances between lap. ?

sorry do you mean cut lenght?

Posted
1 hour ago, vandehuy said:

sorry do you mean cut lenght?

@vandehuy yes how you state the 8637 ,  11700 , and so on. ?

 

 

Posted
16 hours ago, devitg said:

@vandehuy yes how you state the 8637 ,  11700 , and so on. ?

 

 

Sir I already have a pline cutting lisp, can you help me complete the dim pline based on this lisp

Cut pline-NTT.VLX

Posted

This can be a start ?

 

(vl-load-com)
(defun add_vtx (obj add_pt ent_name / sw ew nw bulg)
  (vla-GetWidth obj (fix add_pt) 'sw 'ew)
  (vla-addVertex
    obj
    (1+ (fix add_pt))
    (vlax-make-variant
      (vlax-safearray-fill
        (vlax-make-safearray vlax-vbdouble (cons 0 1))
          (list
            (car (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name))
            (cadr (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name))
          )
      )
    )
  )
  (setq
    nw
    (*
      (/
        (- ew sw)
        (- (vlax-curve-getdistatparam obj (1+ (fix add_pt))) (vlax-curve-getdistatparam obj (fix add_pt)))
      )
      (- (vlax-curve-getdistatparam obj add_pt) (vlax-curve-getdistatparam obj (fix add_pt)))
    )
    bulg (atan (vla-GetBulge obj (fix add_pt)))
  )
  (vla-SetBulge obj
    (fix add_pt)
    (/
      (sin (* 4 bulg (- add_pt (fix add_pt)) 0.25))
      (cos (* 4 bulg (- add_pt (fix add_pt)) 0.25))
    )
  )
  (vla-SetBulge obj
    (1+ (fix add_pt))
    (/
      (sin (* 4 bulg (- (1+ (fix add_pt)) add_pt) 0.25))
      (cos (* 4 bulg (- (1+ (fix add_pt)) add_pt) 0.25))
    )
  )
  (vla-SetWidth obj
    (fix add_pt)
    sw
    (+ nw sw)
  )
  (vla-SetWidth obj
    (1+ (fix add_pt))
    (+ nw sw)
    ew
  )
  (vla-update obj)
)
(defun c:NTT ( / ss AcDoc Space len lap n ename obj dxf_10 p1 p2 p_mid brk1 brk2 lst_brk
                 dxf_obj dxf_43 dxf_38 dxf_39 dxf_10 dxf_40 dxf_41 dxf_42 dxf_39 dxf_210 lst_tmp where count ltmp e_last nw_pt)
  (princ "\nSelect polyline")
  (setq ss (ssget '((0 . "LWPOLYLINE") (90 . 4) (70 . 0))))
  (cond
    (ss
      (setq
        AcDoc (vla-get-ActiveDocument (vlax-get-acad-object))
        Space
        (if (= 1 (getvar "CVPORT"))
          (vla-get-PaperSpace AcDoc)
          (vla-get-ModelSpace AcDoc)
        )
      )
      (vla-startundomark AcDoc)
      (initget 6)
      (setq len (getdist "\nEnter cut length? <11700>: "))
      (if (not len) (setq len 11700.0))
      (initget 6)
      (setq lap (getdist "\nEnter lap length? <1000>: "))
      (if (not lap) (setq lap 1000.0))
      (repeat (setq n (sslength ss))
        (setq
          ename (ssname ss (setq n (1- n)))
          obj (vlax-ename->vla-object ename)
          dxf_10 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ename)))
          p1 (vlax-curve-getPointAtParam ename 1)
          p2 (vlax-curve-getPointAtParam ename 2)
        )
        (cond
          ((> (distance p1 p2) len)
            (setq
              p_mid (vlax-curve-getPointAtParam ename 1.5)
              brk1 (polar p_mid (angle p_mid p1) (* len 0.5))
              brk2 (polar p_mid (angle p_mid p2) (* len 0.5))
              lst_brk (list brk2 brk1)
            )
            (mapcar '(lambda (x) (add_vtx obj (vlax-curve-getparamatpoint ename x) ename)) lst_brk)
            (setq dxf_obj (entget ename))
            (if (cdr (assoc 43 dxf_obj))
              (setq dxf_43 (cdr (assoc 43 dxf_obj)))
              (setq dxf_43 0.0)
            )
            (if (cdr (assoc 38 dxf_obj))
              (setq dxf_38 (cdr (assoc 38 dxf_obj)))
              (setq dxf_38 0.0)
            )
            (if (cdr (assoc 39 dxf_obj))
              (setq dxf_39 (cdr (assoc 39 dxf_obj)))
              (setq dxf_39 0.0)
            )
            (setq
              dxf_10 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) dxf_obj))
              dxf_40 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 40)) dxf_obj))
              dxf_41 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 41)) dxf_obj))
              dxf_42 (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 42)) dxf_obj))
              dxf_210 (cdr (assoc 210 dxf_obj))
            )
            (if (not (zerop (boole 1 (cdr (assoc 70 dxf_obj)) 1)))
              (setq
                dxf_10 (append dxf_10 (list (car dxf_10)))
                dxf_40 (append dxf_40 (list (car dxf_40)))
                dxf_41 (append dxf_41 (list (car dxf_41)))
                dxf_42 (append dxf_42 (list (car dxf_42)))
              )
            )
            (repeat (1+ (length lst_brk))
              (setq
                ltmp nil
                lst_tmp (vl-member-if '(lambda (x) (and (equal (car x) (caar lst_brk) 1E-08) (equal (cadr x) (cadar lst_brk) 1E-08))) dxf_10)
                where (if lst_tmp (vl-position (car lst_tmp) dxf_10) 0)
              )
              (repeat (setq count (- (length dxf_10) where))
                (setq ltmp (cons (mapcar '(lambda (x y) (cons y (nth where x))) (list dxf_10 dxf_40 dxf_41 dxf_42) (list 10 40 41 42)) ltmp))
                (setq where (1+ where))
              )
              (entmake
                (append
                  (list
                    (cons 0 "LWPOLYLINE")
                    (cons 100 "AcDbEntity")
                    (assoc 67 dxf_obj)
                    (assoc 410 dxf_obj)
                    (assoc 8 dxf_obj)
                    (if (assoc 62 dxf_obj) (assoc 62 dxf_obj) (cons 62 256))
                    (if (assoc 6 dxf_obj) (assoc 6 dxf_obj) (cons 6 "BYLAYER"))
                    (if (assoc 370 dxf_obj) (assoc 370 dxf_obj) (cons 370 -1))
                    (cons 100 "AcDbPolyline")
                    (cons 90 (length ltmp))
                    (cons 70 (boole 1 (cdr (assoc 70 dxf_obj)) 128))
                    (cons 38 dxf_38)
                    (cons 39 dxf_39)
                  )
                  (apply 'append (reverse ltmp))
                  (list (cons 210 dxf_210))
                )
              )
              (setq e_last (entlast))
              (if (eq (length lst_brk) 1)
                (progn
                  (vla-Offset (vlax-ename->vla-object e_last) (* lap -0.05))
                  (entdel e_last)
                )
                (if (zerop (length lst_brk))
                  (progn
                    (setq nw_pt (polar (cdr (assoc 10 (reverse (entget e_last)))) (angle (cdr (assoc 10 (reverse (entget e_last)))) p_mid) lap))
                    (entmod (reverse (subst (cons 10 nw_pt) (assoc 10 (reverse (entget e_last))) (reverse (entget e_last)))))
                  )
                  (progn
                    (setq nw_pt (polar (cdr (assoc 10 (entget e_last))) (angle (cdr (assoc 10 (entget e_last))) p_mid) lap))
                    (entmod (subst (cons 10 nw_pt) (assoc 10 (entget e_last)) (entget e_last)))
                  )
                )
              )
              (repeat (1- count)
                (setq
                  dxf_10 (reverse (cdr (reverse dxf_10)))
                  dxf_40 (reverse (cdr (reverse dxf_40)))
                  dxf_41 (reverse (cdr (reverse dxf_41)))
                  dxf_42 (reverse (cdr (reverse dxf_42)))
                )
              )
              (setq lst_brk (cdr lst_brk) ltmp nil)
            )
            (entdel ename)
          )
          (T (princ "\nCut length is too large"))
        )
      )
      (vla-endundomark AcDoc)
    )
    (T (princ "\nNo valid object delected for the fonction"))
  )
  (prin1)
)

 

  • Like 1
Posted

Am I missing something? Is it not pick a start and end point, then draw the bars with overlap and a max length of 11700. Include dims etc.

Posted
5 hours ago, BIGAL said:
Am I missing something? Is it not pick a start and end point, then draw the bars with overlap and a max length of 11700. Include dims etc.

You can just select a line...
Without specifying points...

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