APPLOAD'ing this in results in the same syntax error
;;;;;
; need to be able to specify area to work in for roof edge offset
; retrieving list of entities to offset
; exterior roof
; roof distinction either by different layers for int/ext or by assuming ext roof is outer edge of dwg
;
; interior roof
; mech/HVAC
; offset breakdown
; pline (rec is same as pline) "LWPOLYLINE"
; closed pline
; pline against edge (3 sides)
; pline against corner (2 sides)
; circle
; just copying circle won't work, must draw new
; MAIN PROGRAM OUTLINE
; retrieve list of all entities to offset
; join all lines to polyline
; "offset" each
; copy, displacement (doesn't require joining, would require multiple copies to be made + trimming) OR ent functions (more complicated, potentially more robust across versions)
; trim
; optional end message display
; ((-1 . <Entity name: 23aff7d2b90>)
; (0 . "CIRCLE")
; (330 . <Entity name: 23a94a08f70>)
; (5 . "43CE71")
; (100 . "AcDbEntity")
; (67 . 0)
; (410 . "Model")
; (8 . "PV Vents Skylights Roof Drains")
; (100 . "AcDbCircle")
; (10 6.68465e+08 -6.12824e+08 0.0)
; (40 . 71.3673) !! -> RADIUS (default units - inches)
; (210 0.0 0.0 1.0))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; PAST PROTOTYPES
; PROTO. 2: 4' offset (layer "PV VENTS SKYLIGHTS ROOF DRAINS", color BYLAYER) around all circles on layer "PV Roof Obstructions"
; MOD - error handling/checking throughout
(defun c:OFFSETAUTO (/ offset circSel circDef x y)
; offset vars
(setq offset 4) ; 4 inch offset
(setq osLayer "PV VENTS SKYLIGHTS ROOF DRAINS") ; layer of offset
(setq osColor "BYLAYER") ; offset color
(if (not (ssget "_I"))
; if no currently active selection set:
(princ "\nhere")
(progn
(setq pt1 (getpoint "\nSpecify first corner: "))
(setq pt2 (getcorner pt1 "\nSpecify opposite corner: "))
(setq ss (ssget "_C"
pt1
pt2
'((0 . "CIRCLE") (8 . "PV Roof Obstructions")) ; select all circles on PV Roof Obstructions layer
)
)
)
; else there is an active selection set:
(setq ss (ssget "_I"
'((0 . "CIRCLE") (8 . "PV Roof Obstructions")) ; select all circles on PV Roof Obstr layer from implied ss
)
)
)
; DEBUGGING - print length of selection set
; (princ
; (strcat "\nSSLENGTH: "
; (itoa (sslength ss))
; )
; )
; loop through entities in selection set
(setq ssnum 0)
(repeat (sslength ss)
; DEBUGGING - Print ename of each entity in ss
; (princ (strcat "\n"
; (vl-princ-to-string (ssname ss ssnum))
; )
; )
; Get entity name and assoc list for each entity
(setq ename (ssname ss ssnum))
(setq circDef (entget ename))
; getting x, y coord, radius of each circle
; could make helper for radius too
(getCoord "x" circDef)
(getCoord "y" circDef)
;; HERE - RADIUS HELPER
(setq radPair (assoc '40 circDef))
(setq rad (cdr radPair))
; modified radius, radius dotted pair
(setq radNew (+ rad offset))
(setq radPairNew (cons 40 radNew))
; current layer, new layer
(setq cLayerPair (assoc '8 circDef))
(setq osLayerPair (cons 8 osLayer))
; current color dotted pair, new color dotted pair
(setq cColorPair (assoc '62 circDef))
(setq osColorPair (cons 62 osColor))
; MOD - helper func using mapcar to make changes to assoc list given new dotted pair
; new circle assoc list with changed radius, layer
(setq newCircDef (subst radPairNew radPair circDef))
(setq newCircDef (subst osLayerPair cLayerPair newCircDef))
; change to specified color
(command "COLOR" osColor)
; create offsets
(setq osEntDef (entmake newCircDef))
; increment ssnum
(setq ssnum (1+ ssnum))
)
; exit quietly
(princ)
)
;;; HELPER FUNCTIONS ;;;
; GETCOORD - returns x or y coordinate of entity
; ADD ERROR HANDLING
(defun getCoord (coordName entList /)
; VARLIST
;; INPUTS
;;; coordName - name of coordinate to get, x or y (STR)
;;; entList - entity definition to extract coordinate from (ASSOC LIST)
;; LOCAL VARS - NONE
(if (equal (strcase coordName T) "x")
; if x coord:
(float
(nth 1
(assoc '10 entList)
)
)
; else y coord:
(float
(nth 2
(assoc '10 entList)
)
)
)
)
; could make helper for radius too