8
42
34
初来乍到
使用道具 举报
114
1万
中流砥柱
49
1246
1210
后起之秀
15
209
121
初露锋芒
;;; ------------------------------------------------------------------------;;; PLAN_STUDWALL.lsp v1.0;;;;;; Copyright © December, 2006;;; Timothy G. Spangler;;;;;; Permission to use, copy, modify, and distribute this software;;; for any purpose and without fee is hereby granted, provided;;; that the above copyright notice appears in all copies and;;; that both that copyright notice and the limited warranty and;;; restricted rights notice below appear in all supporting;;; documentation.;;;;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR;;; PURPOSE AND OF MERCHANTIBILITY ARE HEREBY DISCLAIMED BY THE;;; PROGRAMMER.;;;;;; -----------------------------------------------------------------------(defun c:STUDWALL (/)(STUD_WALL "CMD" nil nil nil))(defun STUD_WALL (RunType StudSize StudSpace DryWall / *error* OldClayer OldCmdEcho OldLunits OldLuPrec ActiveDoc Space StudSize StartPoint EndPoint StudSpace WallLength WallAngle Angle-180 Angle+90 Width Length NoStuds ) ;;; Begin Error Handler -------------------------------------------------(defun *error* (MSG) (if (not (member MSG '("Function cancelled" "quit / exit abort"))) (princ (strcat "\n*** Program Error: " (strcase MSG) " ***")) (princ "\n... Program Cancelled ...") ) (while (< 0 (getvar "cmdactive")) (command) ) ;; Reset environment varialbes (STUDWALL_RESET_ENV));;; End Error Handler ---------------------------------------------------(STUDWALL_SET_ENV));;; ------------ SET ENVIROMENT BEFORE LAUNCH(defun STUDWALL_SET_ENV(/)(setq OldClayer (getvar "CLAYER"))(setq OldCmdEcho (getvar "CMDECHO"))(setvar "CMDECHO" 0)(command "_undo" "BE")(setq ActiveDoc (vla-get-activedocument (vlax-get-acad-object)))(setq Space (if (= (getvar "cvport") 1) (vla-get-paperspace ActiveDoc) (vla-get-modelspace ActiveDoc) ));; Create framing layer(STUD_CREATE_LAYER "A-FRAM-WALL" "Framing Plan - Wall framing linework" "Continuous" "25" "157" "0")(setvar "CLAYER" "A-FRAM-WALL");; Create wall(if (= RunType "CMD") (RUN_STUDWALL) (GET_STUD_POINTS StudSize StudSpace DryWall)));;; ------------ RUN STUDWALL(defun RUN_STUDWALL (/);; Get wall thickness(initget 1 "4 6 8")(setq StudSize (getkword " \nEnter wall Thickness: (4=2x4/6=2x6/8=2x8)"));; Get stud spacing(while (< (setq StudSpace (getreal " \nEnter stud spacing: "))6.0) (alert " Stud spacing Needs to be greater than 6" ")) ;; Get drywall(initget 1 "Yes y Y No n N")(setq DryWall (strcase (getkword " \nAdd drywall?: (Yes/No)")))(GET_STUD_POINTS StudSize StudSpace DryWall))(defun GET_STUD_POINTS (StudSize StudSpace DryWall /);; Create stud block(CREATE_STUD StudSize);; Define start and end points(setq StartPoint (getpoint " \nDefine Start point for studwall: "))(setq EndPoint (getpoint StartPoint " \nDefine end point for studwall: ")) ;; Set wall variables(setq WallLength (distance StartPoint EndPoint))(setq WallAngle (angle StartPoint EndPoint)) (setq Angle-180 (- WallAngle (DTR 180)))(setq Angle+90 (+ WallAngle (DTR 90)));; Justify start and end points(setq StartPoint (polar StartPoint Angle+90 (/ Width 2)))(setq EndPoint (polar EndPoint Angle+90 (/ Width 2)));; Create the wall(CREATE_STUDWALL));;; ------------ CREATE STUDWALL(defun CREATE_STUDWALL ( / Point Temp DWallLine1 DWallLine2 WallLine1 WallLine2 WallCenter WallEnd1 WallEnd2);; Create first stud(INSERT_STUD BlockName (polar StartPoint WallAngle (/ Length 2)) WallAngle);; Count the number of studs(setq NoStuds 1);; Create intermediate studs(setq Point StartPoint)