Author Topic: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners  (Read 1279 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 827
Hello guys.

From now on I need to draw the Internal LWpolyline from a combination of LWpolylines which they are on Layer name = External and the new created to Layer name: Internal as the attached image and drawing.

Hope someone would help me with this process.

Attachments: AutoCAD drawing 2007 + Image.

Many thanks.


ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Just offset outer LWPOLY and then apply FILLET - "Polyline" option with radius 2.5... Then place new LWPOLY to your layer...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Coder

  • Swamp Rat
  • Posts: 827
Just offset outer LWPOLY and then apply FILLET - "Polyline" option with radius 2.5... Then place new LWPOLY to your layer...

Hello.

I just want to do the job with Autolisp and without any intervention from the user.
Can you give any example please?

Thank you.

Coder

  • Swamp Rat
  • Posts: 827
Anyone interested to help me? :thinking:

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
I think to do it in one pick is too complex a lisp for someone to generate. It could be done but may not work very well.

Below is a very old routine I modified for your use. You will need to pick the points forming the external layer path & hit enter. Then pick which side to offset.
This routine is a close as I am willing to get to the solution.

Code: [Select]
;;       DrawOffset.lsp
;;      Created by C. Alan Butler  2003
;;
;;; Draw a poly line and then offset it & erase the original
;;;
;;;   THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED
;;;   WARRANTY.  ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR
;;;   PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.
;;;
;;;
;;

          ;======================
          ;    Start of Routine
          ;======================
(defun C:offi (/ pt1 pt2 usercmd str en1 en2 os:off *error*)
  ;;
  ;; error function & Routine Exit
  (defun *error* (msg)
    (if
      (not (member msg
                   '("console break" "Function cancelled" "quit / exit abort" "")
           )
      )
       (princ (strcat "\nError: " msg))
    )     ; if
    (and USEROS (setvar "osmode" useros))
    (if (not(equal en (entlast)))
      (entdel (entlast))
    )
    (princ)
  )       ;end error function   

  (defun os:off () ; set osmode off & keep settings
    (if (<= (getvar "osmode") 15359)
      (setvar "osmode" (boole 6 (getvar "osmode") 16384))
    )
  )       ; defun

;;  CAB version
;;  Make or Update layer    ;;(make_lay "Layer11" nil nil)
(defun make_lay (n c lt / l) ;;(make_lay "Layer11" 2 "Continuous")
 (if (tblsearch "Layer" n)
   (setq l (vlax-ename->vla-object (tblobjname "Layer" n)))
   (setq l (vla-add (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) n))
 )
 (if c (vla-put-color l c)(vla-put-color l 7))
 (if lt(vla-put-Linetype l lt)(vla-put-Linetype l "Continuous"))
)

 
  ;; -------  Some Housekeeping   ------------------
  (setq usercmd (getvar "CMDECHO"))
  (setvar "CMDECHO" 0)
  (setvar "PLINEWID" 0)
  (setq useros (getvar "osmode")
        str    ""
        en  (entlast)
  )
  (setvar "osmode" 175)
  ;; Draw the pline
  (if (setq pt1 (getpoint "/nPick points, Enter when done."))
    (progn
      (command "PLINE" pt1 (Setq pt2 (getpoint pt1))) ;_ Start the Pline
      (while
        (progn
          (initget "C")
          (setq pt2 (getpoint pt2 "\nNext point: "))
          (cond
            ((null pt2) (command ""))
            ((member pt2 '("C" "c")) (command pt2))
            ((listp pt2) (command pt2) t)
          )
        )
      ) ;_ WHILE
      (princ)
      (setq en1 (entlast))
      (os:off)
      (initget 1)
      (setq pto (getpoint "\nSide to offset:"))
      ;; The user can also specify a distance by entering a number in the AutoCAD current distance units format.
      ;; (setq dist (getdist "\nEnter offset distance:"))
      (setq dist 4.25)
      (command "_.offset" dist en1 pto "")
      (entdel en1) ; remove the user drawn line
      (setq en1 (entlast)
            filr (getvar "FILLETRAD"))
      (setvar "FILLETRAD" 2.5)
      (command "_.fillet" "P" en1 "")
      (setvar "FILLETRAD" filr)
      (make_lay "Internal" 221 "Continuous")
      (command "._CHANGE" "L" "" "P" "LA" "Internal" "")
    )
  )

  ;;==========  Exit Sequence  ============
  (setvar "osmode" useros)
  (setvar "CMDECHO" usercmd)
  ;; Exit quietly
  (princ)

) ;_end of defun
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Coder

  • Swamp Rat
  • Posts: 827
That is so nice of you CAB, many thanks.

ChrisCarlson

  • Guest
Once you start get super specific in the usage, typically the less people will assist. If you truly need this accomplished you should have no problem employing the services of a company to write this.