This is what i have.
(defun c:WB40 ()
(c:bv (setq vehname (WB40)
Vehunit (I)
startdrawpoint
(getpoint
"/nWhere would you like to Start the vehicle: "
)
vehbodylength
(180)
vehwidth (48)
vehfronthang
(48)
vehwheelbase
(150)
vehsteerlock
(6)
vehsteerlocktime
(28.4)
vehwheelwidth
(96)
vehrearhitch
(0.001)
trailhave (yes)
vehartangle
(75)
Trailname (WB-40-Trailer)
trailunits
(I)
trailerhitchtowheel
(330)
trailerwheelwidth
(102)
trailerfronthang
(36)
trailerbodylength
(360)
trailerwidth
(102)
)
(princ)
)
Here is the main code that i would like to use on my code to create the vehicle.
;;;
;;;
;;; BuildVehicle.LSP
;;; Copyright 2006 Stephen Hitchcox
;;; BuildVehicle.LSP draws vehicles for use by Tturn.lsp in AutoCAD.
;;;
;;; This program is free software under the terms of the
;;; GNU (GNU--acronym for Gnu's Not Unix--sounds like canoe)
;;; General Public License as published by the Free Software Foundation,
;;; version 2 of the License.
;;;
;;; You can redistribute this software for any fee or no fee and/or
;;; modify it in any way, but it and ANY MODIFICATIONS OR DERIVATIONS
;;; continue to be governed by the license, which protects the perpetual
;;; availability of the software for free distribution and modification.
;;;
;;; You CAN'T put this code into any proprietary package. Read the license.
;;;
;;; If you improve this software, please make a revision submittal to the
;;; copyright owner at hdesign@ica.net
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License on the World Wide Web for more details.
;;;
;;; OVERVIEW
;;; BuildVehicle.LSP draws attributed blocks of vehicles that are required
;;; by Tturn.lsp, for approximating the paths of trucks as they drive.
;;;
;;; GETTING STARTED
;;; Load and run BuildVehicle. It will ask you for all of the parameters
;;; for your vehicle, and draw a unique attributed block. You can build a library
;;; of vehicles for future use. BuildVehicle.lsp runs using "BV" or "BuildVehicle"
;;; from the command line. Axles should be the "centroid" of any group of multiple
;;; axles.
;;;
;;; Data for turning angles and time to turn is for future use, so enter
;;; dummy data if you do not know it.
;;;
;;; enter "N" for no trailer, but still give place holder data for the non-existent
;;; trailer. It will not be drawn.
;;;
;;; The parameters are used to build a scale block of the vehicle you are
;;; defining, which is made into a block.
;;;
;;; You can change the attributes in the block if you make a mistake, but the block
;;; itself does not change size (it is not parametric).
;;;
;;; If you make a new block with the same name as an existing one, it will overwrite
;;; the old one, or perhaps fail. If this happens, erase all errant blocks, and purge
;;; the old block from the drawing file.
;;;
;;; Draw the path for the vehicle as the route taken by the front left tire. A future
;;; version of this program might add path by centre or by right side of vehicle, to
;;; suit other driving standards.
;;;
;;; After running Turn, manually adjust the route to move the vehicle off of collisions
;;; and then run turn again to see if you now can drive the route.
;;;
;;; Remember, there is almost no error correction in this program. If you enter
;;; impossible geometry, the program will happily draw it. Please report issues and
;;; requested functionality to the author.
;;;
;;;
;;; REFERENCE
;;; Vehicle dimensions (ft) Min. Outside Min. Inside
;;; Vehicle Width WB1 WB2 Rad Rad. (check)
;;; P (passenger) 7 11 24.0 13.8
;;; SU (single truck) 8.5 20 42.0 27.8
;;; BUS 8.5 25 42.0 24.4
;;; WB-40 8.5 13 27 40.0 18.9
;;; WB-50 8.5 20 30 45.0 19.2
;;;
;;; Development Notes:
;;;
;;; 1) implement better error correction
;;;
;;; 2) collect and share correctly dimensioned standard vehicles
;;;
;;; 3) revise to not require data for non-existent trailers, and to allow multiple
;;; trailers
;;;
;;; 4) revise to draw tires centred on the tire paths
;;;
;;; 5) 080205 imperial scaling issue resolved, and input for dimensional information
;;; revised to allow picks from drawing
;;;C:BV short form call for (C:BUILDVEHICLE)
(DEFUN
C:BV
()
(C:BUILDVEHICLE)
)
(DEFUN
C:BUILDVEHICLE
()
;;; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;;; NEED TO ADD SETTING OF DEFAULT VALUES HERE,
;;; THEN LOOP THROUGH TO CHANGE TO CUSTOM NUMBERS,
;;; THEN PRESENT USER WITH COMPLETE LAYOUT BEFORE CREATING BLOCK,
;;; AND ALLOW USER TO CHANGE BY GOING THROUGH LOOP AGAIN
;;; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
(SETQ VEHNAME (GETSTRING T "\nEnter Name of Vehicle: "))
(SETQ INPUTTEST "f")
(WHILE (= INPUTTEST "f")
(PROGN
(SETQ
VEHUNITS
(GETSTRING "\nEnter Units Type 'M'etric or 'I'mperial: ")
)
(SETQ VEHUNITS (STRCASE VEHUNITS))
(IF (OR (= VEHUNITS "M") (= VEHUNITS "I"))
(SETQ INPUTTEST "T")
(PRINC
"\nSorry, this value cannot be used, please try again"
)
)
)
)
(SETQ
STARTDRAWPOINT
(GETPOINT "\nPick midpoint of front bumper: ")
)
(SETQ
VEHBODYLENGTH
(GETDIST STARTDRAWPOINT "\nLength of Vehicle: ")
)
(SETQ
VEHWIDTH
(* 2 (GETDIST STARTDRAWPOINT "\nHalf width of Vehicle: "))
)
;; Record VEHWIDTH
;; MAKEATTRIBUTE usage: (MakeAttribute InsPoint InsAngle Tag Value AttribLayer AttPrompt TextSize)
(MAKEATTRIBUTE
(POLAR STARTDRAWPOINT PI (/ VEHWIDTH 15))
90.0
"VEHWIDTH"
(RTOS VEHWIDTH 2)
"AttributeLayer"
"Vehicle width"
(/ VEHWIDTH 15)
)
(SETQ VEHBLOCKLIST (SSADD (ENTLAST)))
;; Record VEHBODYLENGTH
(MAKEATTRIBUTE
(POLAR
(POLAR STARTDRAWPOINT (* 1.5 PI) (* VEHWIDTH 0.55))
0.0
(/ VEHBODYLENGTH 2)
)
0.0
"VEHBODYLENGTH"
(RTOS VEHBODYLENGTH 2)
"AttributeLayer"
"Vehicle body length"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw BODY
(DRAWBOX
(POLAR STARTDRAWPOINT (* 1.5 PI) (/ VEHWIDTH 2))
VEHBODYLENGTH
VEHWIDTH
"truckbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
(SETQ
VEHFRONTHANG
(GETREAL "\nEnter front overhang from Bumper to Axle: ")
)
;; Record front axle offset
(MAKEATTRIBUTE
(POLAR STARTDRAWPOINT 0.0 (/ VEHFRONTHANG 2))
0.0
"VEHFRONTHANG"
(RTOS VEHFRONTHANG 2)
"AttributeLayer"
"Vehicle front overhang"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
(SETQ
VEHWHEELBASE
(GETDIST "\nEnter vehicle wheelbase: ")
)
(IF (< VEHBODYLENGTH (+ VEHFRONTHANG VEHWHEELBASE))
(PRINC
"\nCaution, Vehicle Length is shorter than sum of Front Overhang and Wheelbase. Errors could occur."
)
)
;; Record rear axle location
(MAKEATTRIBUTE
(POLAR STARTDRAWPOINT 0.0 (+ VEHFRONTHANG VEHWHEELBASE))
90
"VEHWHEELBASE"
(RTOS VEHWHEELBASE 2)
"AttributeLayer"
"Vehicle wheelbase"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record name of vehicle
(MAKEATTRIBUTE
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG (/ VEHWHEELBASE 2))
)
0.0
"VEHNAME"
VEHNAME
"AttributeLayer"
"Vehicle name"
(/ VEHWIDTH 10)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record units of vehicle
(MAKEATTRIBUTE
(POLAR
(POLAR STARTDRAWPOINT (* 1.5 PI) (* VEHWIDTH 0.25))
0.0
(/ VEHBODYLENGTH 2)
)
0.0
"VEHUNITS"
VEHUNITS
"AttributeLayer"
"Vehicle units (Metric or Imperial)"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;;; VehSteerLock isn't currently functional.
;;; (setq VehSteerLock 0.0)
(SETQ VEHSTEERLOCK (GETANGLE "\nEnter vehicle Steering Lock Angle: (note that this is required but not used at this time)"))
;; Record vehicle Steering Lock Angle
(MAKEATTRIBUTE
(POLAR STARTDRAWPOINT 0.0 (/ VEHFRONTHANG 3))
90.0
"VEHSTEERLOCK"
(ANGTOS VEHSTEERLOCK 0)
"AttributeLayer"
"Vehhicle steering lock angle"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;;; VEHSTEERLOCKTIME isn't currently functional.
;;; (setq VehSteerLockTime 0.0)
(SETQ
VEHSTEERLOCKTIME
(GETREAL "\nEnter vehicle steering lock time: (note that this is required but not used at this time)")
)
;; Record vehicle steer lock time
(MAKEATTRIBUTE
(POLAR STARTDRAWPOINT 0.0 (* 2 (/ VEHFRONTHANG 3)))
90.0
"VEHSTEERLOCKTIME"
(RTOS VEHSTEERLOCKTIME)
"AttributeLayer"
"Vehicle steer lock time"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
(SETQ
VEHWHEELWIDTH
(GETDIST
"\nEnter maximum axle width to middle of wheels: "
)
)
;; Record wheel width
(MAKEATTRIBUTE
(POLAR STARTDRAWPOINT 0.0 VEHFRONTHANG)
90.0
"VEHWHEELWIDTH"
(RTOS VEHWHEELWIDTH 2)
"AttributeLayer"
"Vehicle wheel width"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw tires
;; Define Tire Size as 1/10th of vehicle dimensions (arbitrary, could be a future setting)
(SETQ WHEELWIDTH (/ VEHWIDTH 10))
(SETQ WHEELLENGTH (/ VEHBODYLENGTH 10))
;; DRAW FRONT LEFT wheel
(SETQ
WHEELFLSTARTX
(+ (CAR STARTDRAWPOINT)
(- VEHFRONTHANG (/ WHEELLENGTH 2))
)
)
(SETQ WHEELFLSTARTY (- (CADR STARTDRAWPOINT) (+ (/ VEHWHEELWIDTH 2) (/ WHEELWIDTH 2))))
(DRAWBOX
(LIST WHEELFLSTARTX WHEELFLSTARTY)
WHEELLENGTH
WHEELWIDTH
"truckbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw front left target point
(SETQ
TARGETX
(+ (CAR STARTDRAWPOINT)
VEHFRONTHANG
)
)
(SETQ
TARGETY
(- (CADR STARTDRAWPOINT)
(/ VEHWHEELWIDTH 2)
)
)
(DRAWTARGET
(LIST TARGETX TARGETY)
WHEELLENGTH
WHEELWIDTH
"truckbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw front right wheel
(SETQ
WHEELFRSTARTX
(+ (CAR STARTDRAWPOINT)
(- VEHFRONTHANG (/ WHEELLENGTH 2))
)
)
(SETQ
WHEELFRSTARTY
(+ (CADR STARTDRAWPOINT)
(- (/ VEHWHEELWIDTH 2) (/ WHEELWIDTH 2))
)
)
(DRAWBOX
(LIST WHEELFRSTARTX WHEELFRSTARTY)
WHEELLENGTH
WHEELWIDTH
"truckbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw rear left wheel
(SETQ
WHEELRLSTARTX
(+ (CAR STARTDRAWPOINT)
(- VEHFRONTHANG (/ WHEELLENGTH 2))
VEHWHEELBASE
)
)
(SETQ WHEELRLSTARTY (- (CADR STARTDRAWPOINT) (+ (/ VEHWHEELWIDTH 2) (/ WHEELWIDTH 2))))
(DRAWBOX
(LIST WHEELRLSTARTX WHEELRLSTARTY)
WHEELLENGTH
WHEELWIDTH
"truckbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw rear right wheel
(SETQ
WHEELRRSTARTX
(+ (CAR STARTDRAWPOINT)
(- VEHFRONTHANG (/ WHEELLENGTH 2))
VEHWHEELBASE
)
)
(SETQ
WHEELRRSTARTY
(+ (CADR STARTDRAWPOINT)
(- (/ VEHWHEELWIDTH 2) (/ WHEELWIDTH 2))
)
)
(DRAWBOX
(LIST WHEELRRSTARTX WHEELRRSTARTY)
WHEELLENGTH
WHEELWIDTH
"truckbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
(SETQ
VEHREARHITCH
(GETDIST
"\nEnter distance from rear axle to hitch (forward is NEGATIVE): "
)
)
;;Draw hitch
(SETQ
CIRCLELIST
(LIST
(CONS 0 "CIRCLE")
;(CONS 100 "AcDbEntity")
(CONS 8 "truckbody")
;(CONS 100 "AcDbCircle")
(CONS 40 (/ VEHWIDTH 10))
(CONS
10
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG VEHWHEELBASE VEHREARHITCH)
)
)
)
)
(ENTMAKE CIRCLELIST)
(SSADD (ENTLAST) VEHBLOCKLIST)
(MAKEATTRIBUTE
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG VEHWHEELBASE VEHREARHITCH)
)
90.0
"VEHREARHITCH"
(RTOS VEHREARHITCH 2)
"AttributeLayer"
"Vehicle rear hitch location (forward is NEGATIVE): "
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; End of main vehicle entry
;; Start trailer entry
(INITGET 1 "Yes No")
(SETQ
TRAILHAVE
(GETKWORD
"\nDoes unit have a trailer? Yes/No: "
)
)
(MAKEATTRIBUTE
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG VEHWHEELBASE (* VEHREARHITCH 0.5))
)
90.0
"TRAILHAVE"
TRAILHAVE
"AttributeLayer"
"Does unit have a trailer"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
(COND
((= TRAILHAVE "Yes")
;; Vehicle articulation angle not functional
;; (setq VehArtAngle 20.0)
(SETQ VEHARTANGLE
(GETANGLE "\nEnter vehicle articulation angle: (note that this is required but not used at this time)")
)
;; Record wheel width
(MAKEATTRIBUTE
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG VEHWHEELBASE (* VEHREARHITCH 1.5))
)
90.0
"VEHARTANGLE"
(ANGTOS VEHARTANGLE 0)
"AttributeLayer"
"Vehicle articulation angle"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
(SETQ TRAILNAME (GETSTRING "\nEnter name of trailer: "))
(SETQ INPUTTEST "f")
(WHILE (= INPUTTEST "f")
(PROGN
(SETQ
TRAILUNITS
(GETSTRING "\nEnter Units Type 'M'etric or 'I'mperial: ")
)
(SETQ TRAILUNITS (STRCASE TRAILUNITS))
(IF (OR (= TRAILUNITS "M") (= TRAILUNITS "I"))
(SETQ INPUTTEST "T")
(PRINC
"\nSorry, this value cannot be used, please try again."
)
)
)
)
(SETQ
TRAILERHITCHTOWHEEL
(GETDIST
"\nEnter Distance from Hitch to Trailer Wheel: "
)
)
(SETQ
TRAILERWHEELWIDTH
(GETDIST "\nEnter maximum trailer axle width to middle of wheels: ")
)
(SETQ
TRAILERFRONTHANG
(GETDIST
"\nEnter Distance from Hitch to Front of Trailer: "
)
)
(SETQ
TRAILERBODYLENGTH
(GETDIST "\nEnter Overall Trailer Length: ")
)
(SETQ TRAILERWIDTH (GETDIST "\nEnter Trailer Width: "))
;; Record trailer Length
(MAKEATTRIBUTE
(POLAR
(POLAR STARTDRAWPOINT (* 1.5 PI) (* TRAILERWIDTH 0.55))
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
(/ TRAILERBODYLENGTH 2)
)
)
0.0
"TRAILERBODYLENGTH"
(RTOS TRAILERBODYLENGTH 2)
"AttributeLayer"
"Trailer body length"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record trailer name
(MAKEATTRIBUTE
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
(/ TRAILERBODYLENGTH 2)
)
)
0.0
"TRAILNAME"
TRAILNAME
"AttributeLayer"
"Trailer name"
(/ VEHWIDTH 10)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record trailer units
(MAKEATTRIBUTE
(POLAR
(POLAR STARTDRAWPOINT (* 1.5 PI) (* TRAILERWIDTH 0.25))
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
(/ TRAILERBODYLENGTH 2)
)
)
0.0
"TRAILUNITS"
TRAILUNITS
"AttributeLayer"
"Trailer units"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record trailerfronthang
(MAKEATTRIBUTE
(POLAR
(POLAR STARTDRAWPOINT (* 1.5 PI) (* TRAILERWIDTH 0.55))
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
(- VEHREARHITCH (/ TRAILERFRONTHANG 2))
)
)
0.0
"TRAILERFRONTHANG"
(RTOS TRAILERFRONTHANG 2)
"AttributeLayer"
"Trailer front overhang"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record trailer to wheel length
(MAKEATTRIBUTE
(POLAR
(POLAR STARTDRAWPOINT (* 0.5 PI) (* TRAILERWIDTH 0.55))
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
(/ TRAILERBODYLENGTH 2)
)
)
0.0
"TRAILERHITCHTOWHEEL"
(RTOS TRAILERHITCHTOWHEEL 2)
"AttributeLayer"
"Trailer hitch to wheel length"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record trailer width
(MAKEATTRIBUTE
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
(- TRAILERBODYLENGTH TRAILERFRONTHANG)
)
)
90.0
"TRAILERWIDTH"
(RTOS TRAILERWIDTH 2)
"AttributeLayer"
"Trailer width"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Record trailer wheel width
(MAKEATTRIBUTE
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
TRAILERHITCHTOWHEEL
)
)
90.0
"TRAILERWHEELWIDTH"
(RTOS TRAILERWHEELWIDTH 2)
"AttributeLayer"
"Trailer axle width to middle of wheels"
(/ VEHWIDTH 15)
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw trailer
(DRAWBOX
(POLAR
(POLAR
STARTDRAWPOINT
0.0
(+ VEHFRONTHANG
VEHWHEELBASE
(- VEHREARHITCH TRAILERFRONTHANG)
)
)
(* 1.5 PI)
(/ TRAILERWIDTH 2)
)
TRAILERBODYLENGTH
TRAILERWIDTH
"trailerbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw rear left trailer tire
(SETQ
WHEELRLSTARTX
(- (+ (CAR STARTDRAWPOINT)
VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
TRAILERHITCHTOWHEEL
)
(/ WHEELLENGTH 2)
)
)
(SETQ WHEELRLSTARTY
(- (CADR STARTDRAWPOINT) (+ (/ TRAILERWHEELWIDTH 2) (/ WHEELWIDTH 2)))
)
(DRAWBOX
(LIST WHEELRLSTARTX WHEELRLSTARTY)
WHEELLENGTH
WHEELWIDTH
"trailerbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
;; Draw rear right trailer tire
(SETQ
WHEELRRSTARTX
(- (+ (CAR STARTDRAWPOINT)
VEHFRONTHANG
VEHWHEELBASE
VEHREARHITCH
TRAILERHITCHTOWHEEL
)
(/ WHEELLENGTH 2)
)
)
(SETQ
WHEELRRSTARTY
(+ (CADR STARTDRAWPOINT)
(- (/ TRAILERWHEELWIDTH 2) (/ WHEELWIDTH 2))
)
)
(DRAWBOX
(LIST WHEELRRSTARTX WHEELRRSTARTY)
WHEELLENGTH
WHEELWIDTH
"trailerbody"
)
(SSADD (ENTLAST) VEHBLOCKLIST)
)
)
;;; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;;; ADD REQUEST HERE TO VERIFY DIMENSIONS AND LAYOUT,
;;; DUMP OUT LIST OF VALUES, AND ALSO ZOOM TO HIGHLIGHT VEHICLE
;;; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
;;(makeblock VehBlockList StartDrawPoint (strcat "VEHICLELIB" VEHNAME))
;;makes a block without accessible attributes, needs fix
(COMMAND
"-block"
(STRCAT "VEHICLELIB" VEHNAME)
STARTDRAWPOINT
VEHBLOCKLIST
""
)
(COMMAND
"-insert"
(STRCAT "VEHICLELIB" VEHNAME)
STARTDRAWPOINT
""
""
""
)
(prompt(princ "\nDefinitions complete. Move vehicle into initial position and run TURN to track path. Position Front Left Tire on start of path, and rotate vehicle to approximate starting direction"))
(PRINC)
)
;;;==========================================
;;; End Buildvehicle |
;;;==========================================
;;;Start buildvehicle subfunctions
(DEFUN
DRAWTARGET
(STARTPOINT XLENGTH YLENGTH TARGETLAYER /)
(SETQ TARGETPOLYLIST NIL)
(SETQ
TARGETPOLYLIST
(LIST
(CONS 43 0.0)
(CONS 70 1)
;; closed pline if set
(CONS 90 4)
;; polyline length
(CONS 100 "AcDbPolyline")
(CONS 8 TARGETLAYER)
;; layer name
(CONS 100 "AcDbEntity")
(CONS 0 "LWPOLYLINE")
)
)
(SETQ
TARGETPOLYLIST
(CONS
(CONS
10
(POLAR STARTPOINT (* PI 0.25) (/ YLENGTH 4))
)
TARGETPOLYLIST
)
)
(SETQ
TARGETPOLYLIST
(CONS
(CONS
10
(POLAR STARTPOINT (* PI 1.75) (/ YLENGTH 4))
)
TARGETPOLYLIST
)
)
(SETQ
TARGETPOLYLIST
(CONS
(CONS
10
(POLAR STARTPOINT (* PI 0.75) (/ YLENGTH 4))
)
TARGETPOLYLIST
)
)
(SETQ
TARGETPOLYLIST
(CONS
(CONS
10
(POLAR STARTPOINT (* PI 1.25) (/ YLENGTH 4))
)
TARGETPOLYLIST
)
)
(SETQ TARGETPOLYLIST (REVERSE TARGETPOLYLIST))
(ENTMAKE TARGETPOLYLIST)
)
;;;
(DEFUN
DRAWBOX
(STARTPOINT XLENGTH YLENGTH BOXLAYER /)
(SETQ BOXPOLYLIST NIL)
(SETQ
BOXPOLYLIST
(LIST
(CONS 43 0.0)
(CONS 70 1)
;; closed pline if set
(CONS 90 4)
;; polyline length
(CONS 100 "AcDbPolyline")
(CONS 8 BOXLAYER)
;; layer name
(CONS 100 "AcDbEntity")
(CONS 0 "LWPOLYLINE")
)
)
(SETQ
BOXPOLYLIST
(CONS
(CONS
10
STARTPOINT
)
BOXPOLYLIST
)
)
(SETQ
BOXPOLYLIST
(CONS
(CONS
10
(POLAR STARTPOINT 0.0 XLENGTH)
)
BOXPOLYLIST
)
)
(SETQ
BOXPOLYLIST
(CONS
(CONS
10
(POLAR (POLAR STARTPOINT 0.0 XLENGTH) (/ PI 2) YLENGTH)
)
BOXPOLYLIST
)
)
(SETQ
BOXPOLYLIST
(CONS
(CONS
10
(POLAR STARTPOINT (/ PI 2) YLENGTH)
)
BOXPOLYLIST
)
)
(SETQ BOXPOLYLIST (REVERSE BOXPOLYLIST))
(princ "making boxpolylist")
(ENTMAKE BOXPOLYLIST)
(princ entlast)
)
;;;
;;;
;;;
(DEFUN
MAKEATTRIBUTE
(INSPOINT INSANGLE TAG VALUE ATTRIBLAYER ATTPROMPT TEXTSIZE)
(SETQ ATTRIBUTELIST NIL)
(SETQ
ATTRIBUTELIST
(LIST
(CONS 0 "ATTDEF")
;(CONS 100 "AcDbEntity")
;(CONS 100 "AcDbText")
;(CONS 100 "AcDbAttributeDefinition")
(CONS 1 VALUE)
(CONS 2 TAG)
(CONS 3 ATTPROMPT)
(CONS 8 ATTRIBLAYER)
(CONS 10 INSPOINT) ; not applicable insert point
(CONS 11 INSPOINT) ; this is the real insert point
(CONS 40 TEXTSIZE)
(CONS 50 (* (/ INSANGLE 360) (* 2 PI)))
(CONS 70 😎
(CONS 72 4)
)
)
(ENTMAKE ATTRIBUTELIST)
)