Message 1 of 4
Modifying Lisp Works in autocad but Not Civil 3D
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i Have a weird issue not sure if it has to do with my code:
When i run this Lisp in autocad it modifies my hatch like it suppose to but when i run this in civil 3D it doesnt modify it. Civil 3D is based on the Autocad as the Base application and normally everything that works in Autocad works in civil 3D. Here is my Code:
(defun Hatch_Ansi31_Reversed (/ ss obj entdata newentdata radianAngle)
; Hatch Variables
(setq LayerName ".HATCHING")
(setq HatchName "ANSI31")
(setq HatchScale 0.025)
(setq HatchAngle 90)
; Convert angle from degrees to radians
(setq radianAngle (* HatchAngle (/ pi 180.0)))
; Hatch Command
(command "_.-hatch" pause)
(while (> (getvar 'cmdactive) 0)
(command pause)
)
; Get Last Hatch
(setq ss (ssget "_L"))
; Modify Hatch
(if ss
(progn
(setq obj (ssname ss 0))
(setq entdata (entget obj))
; Modify layer
(setq entdata (subst (cons 8 LayerName) (assoc 8 entdata) entdata))
; Modify hatch pattern
(setq entdata (subst (cons 2 HatchName) (assoc 2 entdata) entdata))
; Modify hatch scale
(setq entdata (subst (cons 41 HatchScale) (assoc 41 entdata) entdata))
; Modify hatch angle
(setq entdata (subst (cons 52 radianAngle) (assoc 52 entdata) entdata))
; Update entity
(entmod entdata)
(entupd obj)
)
)
(prompt "\nHatching Complete!")
(princ)
)
Civil 3D Certified Professional