编辑代码

*(format t "Hello world!     -  lisp.jsrun.net") 
(defun c:CreateRoadOptimizationPlan ()
  ; 设置绘图环境
    (command "_layer" "m" "Roads" "c" "1" "" "") ; 道路层 - 红色
      (command "_layer" "m" "Buildings" "c" "3" "" "") ; 建筑层 - 绿色
        (command "_layer" "m" "Labels" "c" "2" "" "") ; 标注层 - 黄色
          (command "_layer" "m" "Crossings" "c" "5" "" "") ; 交叉口层 - 蓝色
            (command "_layer" "m" "Sidewalks" "c" "7" "" "") ; 人行道层 - 白色
              (command "_layer" "m" "Signs" "c" "4" "" "") ; 标志层 - 青色
                (command "_layer" "m" "Greenery" "c" "83" "" "") ; 绿化层 - 浅绿色
                  
                    ; 设置文字样式
                      (command "-style" "RoadLabels" "宋体" "0" "1" "0" "n" "n" "n")
                        
                          ; 绘制文化南路 (双向单车道,每个车道3米宽)
                            (command "_layer" "s" "Roads" "")
                              (command "_line" "0,0" "100,0" "") ; 北向车道中心线
                                (command "_offset" "3" (entlast) "0,3" "") ; 北向车道边线
                                  (command "_offset" "3" (entlast) "0,-6" "") ; 南向车道边线
                                    
                                      ; 添加文化南路上半部分人行道(十字路口上方)
                                        (command "_layer" "s" "Sidewalks" "")
                                          (command "_offset" "2" (entlast) "0,3" "") ; 北侧人行道外缘
                                            (command "_offset" "2" "l" "" "0,-11" "") ; 南侧人行道外缘
                                              
                                                ; 绘制明德南路
                                                  (command "_layer" "s" "Roads" "")
                                                    (command "_line" "-20,-20" "20,20" "")
                                                      (command "_offset" "3" (entlast) "4,4" "")
                                                        (command "_offset" "3" (entlast) "-4,-4" "")
                                                          
                                                            ; 绘制无名路
                                                              (command "_line" "30,30" "70,30" "")
                                                                (command "_offset" "3" (entlast) "0,3" "")
                                                                  (command "_offset" "3" (entlast) "0,-6" "")
                                                                    
                                                                      ; 绘制东路
                                                                        (command "_line" "80,-20" "80,20" "")
                                                                          (command "_offset" "3" (entlast) "3,0" "")
                                                                            (command "_offset" "3" (entlast) "-6,0" "")
                                                                              
                                                                                ; 优化绿化带设计
                                                                                  (command "_layer" "s" "Greenery" "")
                                                                                    ; 文化南路中央绿化带
                                                                                      (command "_pline" "0,1.5" "50,1.5" "w" "0.3" "0.3" "")
                                                                                        (command "_hatch" "GRAVEL" "1" "0" "l" "")
                                                                                          ; 路口四角绿化
                                                                                            (command "_circle" "45,5" "3")
                                                                                              (command "_hatch" "GRASS" "1" "0" "l" "")
                                                                                                (command "_circle" "55,5" "3")
                                                                                                  (command "_hatch" "GRASS" "1" "0" "l" "")
                                                                                                    (command "_circle" "45,-5" "3")
                                                                                                      (command "_hatch" "GRASS" "1" "0" "l" "")
                                                                                                        (command "_circle" "55,-5" "3")
                                                                                                          (command "_hatch" "GRASS" "1" "0" "l" "")
                                                                                                            
                                                                                                              ; 切换到建筑层绘制建筑物
                                                                                                                (command "_layer" "s" "Buildings" "")
                                                                                                                  
                                                                                                                    ; 绘制5678号公寓 (矩形建筑群)
                                                                                                                      (command "_rectang" "40,5" "60,15")
                                                                                                                        (command "_rectang" "40,15" "60,25")
                                                                                                                          
                                                                                                                            ; 绘制2号教学楼
                                                                                                                              (command "_rectang" "85,-15" "95,-5")
                                                                                                                                
                                                                                                                                  ; 绘制学苑餐厅
                                                                                                                                    (command "_rectang" "50,35" "60,40")
                                                                                                                                      
                                                                                                                                        ; 绘制1号公寓
                                                                                                                                          (command "_rectang" "-15,-15" "-5,-5")
                                                                                                                                            
                                                                                                                                              ; 绘制农大店
                                                                                                                                                (command "_rectang" "10,25" "15,30")
                                                                                                                                                  
                                                                                                                                                    ; 切换到标注层添加文字
                                                                                                                                                      (command "_layer" "s" "Labels" "")
                                                                                                                                                        
                                                                                                                                                          ; 标注道路
                                                                                                                                                            (command "_text" "50,10" "2" "0" "文化南路")
                                                                                                                                                              (command "_text" "0,0" "2" "45" "明德南路")
                                                                                                                                                                (command "_text" "50,35" "2" "0" "无名路")
                                                                                                                                                                  (command "_text" "85,0" "2" "90" "东路")
                                                                                                                                                                    
                                                                                                                                                                      ; 标注建筑物
                                                                                                                                                                        (command "_text" "50,20" "2" "0" "5678号公寓")
                                                                                                                                                                          (command "_text" "90,-10" "2" "0" "2号教学楼")
                                                                                                                                                                            (command "_text" "55,37" "2" "0" "学苑餐厅")
                                                                                                                                                                              (command "_text" "-10,-10" "2" "0" "1号公寓")
                                                                                                                                                                                (command "_text" "12,27" "2" "0" "农大店")
                                                                                                                                                                                  
                                                                                                                                                                                    ; 绘制交叉口 (蓝色十字)
                                                                                                                                                                                      (command "_layer" "s" "Crossings" "")
                                                                                                                                                                                        (command "_color" "5") ; 蓝色
                                                                                                                                                                                          (command "_line" "45,0" "55,0" "")
                                                                                                                                                                                            (command "_line" "50,-5" "50,5" "")
                                                                                                                                                                                              
                                                                                                                                                                                                ; 添加限速25标志
                                                                                                                                                                                                  (command "_layer" "s" "Signs" "")
                                                                                                                                                                                                    (command "_circle" "52,8" "2") ; 限速牌外圈
                                                                                                                                                                                                      (command "_circle" "52,8" "1.8") ; 限速牌内圈
                                                                                                                                                                                                        (command "_text" "52,7.5" "1.5" "0" "25")
                                                                                                                                                                                                          
                                                                                                                                                                                                            (princ "\n优化后的现状图已创建完成,包含:")
                                                                                                                                                                                                              (princ "\n- 文化南路上半部分人行道")
                                                                                                                                                                                                                (princ "\n- 路口限速25标志")
                                                                                                                                                                                                                  (princ "\n- 优化的绿化带设计")
                                                                                                                                                                                                                    (princ)