TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Coder on April 24, 2016, 01:17:57 AM

Title: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners
Post by: Coder on April 24, 2016, 01:17:57 AM
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.

Title: Re: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners
Post by: ribarm on April 24, 2016, 03:24:15 AM
Just offset outer LWPOLY and then apply FILLET - "Polyline" option with radius 2.5... Then place new LWPOLY to your layer...
Title: Re: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners
Post by: Coder on April 24, 2016, 04:30:14 AM
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.
Title: Re: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners
Post by: Coder on April 24, 2016, 08:57:02 AM
Anyone interested to help me? :thinking:
Title: Re: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners
Post by: CAB on April 24, 2016, 05:58:27 PM
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
Title: Re: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners
Post by: Coder on April 25, 2016, 11:19:20 AM
That is so nice of you CAB, many thanks.
Title: Re: Create Internal LWpolyline boundary from outside LWpolyline with Fillet corners
Post by: ChrisCarlson on April 28, 2016, 08:57:25 AM
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.