- ; Functions used in MR_Chainage (CHG)
- ;; Build a list containing all the Vertexes and bulge factors
- ; Requires a variable entlist for use in the locate1stvert routine as well
- ; ****************************************************************************************************
- (defun BuildVertList ()
- (locate1stvert entlist) ; locate the first vertex in the entity data
- (setq VertCount 1) ; Initialise the vertex number count
- (setq VertList nil) ; Initialise the VertList Variable
- (while (<= VertCount VertNum)
- (setq checkval (car (nth n entlist)))
- (if (= (car (nth n entlist)) 10)
- (progn
- ; Set the point data to a point variable in the form of a list (X, Y, Z)
- (setq VertPt (trans (list (cadr (nth n entlist )) (caddr (nth n entlist )) 0.0) 0 1))
- ; Extract the bulge factor
- (setq n (+ n 3))
- (setq BulgeFactor (cdr (nth n entlist)))
- (setq VertList (append VertList (list VertPt BulgeFactor)))
- (setq n (1+ n))
- (setq VertCount (1+ VertCount))
- ) ; end of progn
- ) ; end of if
- (setq n (1+ n))
- ) ; End While
- )
- ; ****************************************************************************************************
- ; This function converts Cartesian to Compass and vice versa
- ; ****************************************************************************************************
- (defun cart2comp (angdegs)
- (if (< angdegs 90)
- (setq angdegs (- 90 angdegs))
- (progn
- (if (< angdegs 180)
- (setq angdegs (+ (- 90 angdegs) 360))
- (progn
- (if (< angdegs 270)
- (setq angdegs (+ (- 90 (- angdegs 180)) 180))
- (setq angdegs (+ (- 90 (- angdegs 270)) 90))
- )
- )
- )
- )
- )
- )
- ; ****************************************************************************************************
- ; Configures the retrieved DIMSCALE and USERI2 values for display in a message dialogue
- ; ****************************************************************************************************
- (defun ConfigSc4Disp ()
- (if (= (rtos basesel 2 0) "") ; Start of If 1
- (setq basesel 0)
- ) ; End of If 1
- (if (= basesel 0) ; Start of If 2
- (progn ; Then
- (setq DispScText (strcat "The Current scale is " DimScVal ". Is this correct?"))
- ) ; End of If 2 then progn
- (progn ; Else
- (setq DispScText (strcat "The Current scale is " DimScVal ". Is this correct?"))
- ) ; End of If 2 Else progn
- ) ; End of If 2
- (setq dcl_id (load_dialog "MR_Dialogues.dcl")) ; Initialise the Dialogue box
- (if (not (new_dialog "message_disp_curr_scale" dcl_id)) (exit)) ; Open the dialogue box
- (set_tile "msg" DispScText)
- (action_tile "Yesbtn" "(done_dialog 1)" ) ; Set and action for the OK Button
- (setq msgresp (start_dialog)) ; Execute the dialogue box and retrieve a response when a button is pushed
- (unload_dialog dcl_id) ; Remove the dialogue box from memory
- ) ; End of ConfigSc4Disp
- ; ****************************************************************************************************
- ; Create a dumbell block
- ; ****************************************************************************************************
- (defun createdumbell ()
- ; Create a selection set to capture any existing dumbell blocks
- (setq dbellsset (ssget "X" (list (cons 2 "dumbell"))))
- (if (= dbellsset nil) ; If there are no dumbell blocks in the drawing
- (progn ; then create it
- (command "zoom" "w" "-10,-10" "10,10")
- (command "line" "-2.5,0" "2.5,0" "")
- (command "circle" "-3.5,0" "1")
- (command "circle" "3.5,0" "1")
- (setq CURRANNOSCALE (getvar "CANNOSCALE"))
- (setvar "CANNOSCALE" "1:1000 (m)")
- (command "block" "dumbell" "A" "Y" "N" "0,0" "w" "-5,-2" "5,2" "")
- (setvar "CANNOSCALE" CURRANNOSCALE)
- (command "zoom" "p")
- ) ; end of block create
- ) ; End of if
- ) ; End of defun
- ; ****************************************************************************************************
- ; Create a dumbell block
- ; ****************************************************************************************************
- (defun createchgtick ()
- ; Create a selection set to capture any existing dumbell blocks
- (setq chgticksset (ssget "X" (list (cons 2 "chgtick"))))
- (if (= chgticksset nil) ; If there are no dumbell blocks in the drawing
- (progn ; then create it
- (command "zoom" "w" "-10,-10" "10,10")
- (command "line" "-2.5,0" "2.5,0" "")
- (setq CURRANNOSCALE (getvar "CANNOSCALE"))
- (setvar "CANNOSCALE" "1:1000 (m)")
- (command "block" "chgtick" "A" "Y" "N" "0,0" "w" "-5,-2" "5,2" "")
- (setvar "CANNOSCALE" CURRANNOSCALE)
- (command "zoom" "p")
- ) ; end of block create
- ) ; End of if
- ) ; End of defun
- ; **********************************************************************************************
- ; Find where a nominated point is on the alignment
- ; **********************************************************************************************
- (defun FindSegmentNumber (CheckPt)
- (setq whilecheck 1) ; Initialise the whilecheck variable. This keeps a count on the vertexes.
- (setq segnumber nil) ; INitialise the detected segment number variable
- (setq n 0 ) ; Initialise the group code counter to 0
- (locate1stvert entlist) ; locate the first vertex. function defined above.
|