Leaderboard
Popular Content
Showing content with the highest reputation on 11/08/2024 in all areas
-
A very simple answer is, it is your turn to do a little home work and learn at same time. Google "RTOS Autodesk" Have a look in the code you should be able to find it very quickly what to change.2 points
-
In the above I've only put in a few details as an example of how you could add in a drop down box - but like all CAD there are many ways to do the same thing. use the above to learn from. In your specific example I'd do something like this though: Add a default value to 'MyAnswer' early in the LISP to avoid errors later, value 0 - the first item in the drop down list In the drop down list only set MyAnswer to the position of the selection. If you use the default above there is no error if the user does nothing with the list Continue in the routing using the value of MyAnswer to set t1 and t2 where they are used and set - below using an if comment but if the drop down is longer, use conds. (defun c:test (/ *error* dch dcl des a MyAnswer t1 t2) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) ; end if (if (= 'file (type des)) (close des) ) ; end if (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) ; end if (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) ; end if (princ) ) ; end defun (setq MyAnswer 1) ;; Initial condition (cond ((not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ; end setq ) ; end not (princ "\nUnable to open DCL for writing.") ) ; end cond 'not' ((progn (foreach str '( "ed : edit_box" "{" " alignment = left;" " width = 20;" ;; " edit_width = 10;" ;; " fixed_width = true;" "}" "" "peacost : dialog" "{" " spacer;" " key = \"dcl\";" " : row" " {" " : ed { key = \"a\"; label = \"Area:\"; }" " : ed { key = \"res1\"; label = \"Calc:\"; is_enabled = false; }" " }" " : row" " {" " : ed { key = \"res2\"; label = \"Text :\"; is_enabled = false; }" " }" " spacer;" " : row {" ;;ADDED THESE LINES " :column { width = 5;" " : text { key = \"File\"; label = \"List Title\"; width = 5; alignment = left;}" " }" ; end column " :column { width = 22;" " :popup_list { key = \"DCLList\"; width = 20; multiple_select = true ; alignment = left; }" " }" ; end column " }" ; end row ;; TO HERE " : row" " {" " : column { width = 10;" " }" ; end column " : column { width = 17;" " : button { key = \"cal\"; label = \"Calc\"; is_default = true;" " is_cancel = false; fixed_width = true; width = 10; }" " }" ; end column " : column { width = 17;" " : button { key = \"OK\"; label = \"OK\"; is_default = true;" " is_cancel = true; fixed_width = true; width = 10; }" " }" ; end column " }" ; end row "}" ) ; end str list (write-line str des) ) ; end foreach (setq des (close des) dch (load_dialog dcl) ) ; end str (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ( (not (new_dialog "peacost" dch)) (princ "\nUnable to display 'peacost' dialog.") ) ; end cond (t ;;Set DCL Tile values (set_tile "dcl" "Any name") (setq MyList '("Option 1" "Option 2" "D" "E")) (start_list "DCLList" 3)(mapcar 'add_list MyList)(end_list) ;;DCL Actions (action_tile "a" "(setq a $value)") (action_tile "DCLList" "(setq MyAnswer (read (get_tile \"DCLList\")))" ) (action_tile "cal" (vl-prin1-to-string '( (lambda ( / x) (set_tile "res1" "") (set_tile "res2" "") (if (= MyAnswer 1) (setq t2 354.84) ;;option 2 (setq t2 322.58) ;; everything else ) (cond ((or (not a) (= "" a)) (alert "xxxxxxxxxxxxx !!!") (mode_tile "a" 2) ) ((not (setq e (distof a))) (alert "xxxxxxxxxxxxxx!!!") (mode_tile "a" 2) ) ((<= e 250) (if (= MyAnswer 1) (setq t1 (/ (+ (* e 2.75) 85) 1.24)) ;;option 2 (setq t1 (/ (+ (* e 2.5) 75) 1.24)) ;; everything else ) (mode_tile "a" 2) (set_tile "res1" (rtos (if (> t1 t2) t2 t1) 2 2)) (set_tile "res2" "text text text") ) ((and (> e 250) (<= e 1000)) (if (= MyAnswer 1) (setq t1 (/ (+ (* e 2.75) 85) 1.24)) ;;option 2 (setq t1 (/ (+ (* e 2.5) 75) 1.24)) ;; everything else ) (mode_tile "a" 2) (set_tile "res1" (rtos (if (> t1 t2) t2 t1) 2 2)) (set_tile "res2" "text text text") ) ((> e 1000) (if (= MyAnswer 1) (setq t1 (/ (+ (* e 2.75) 85) 1.24)) ;;option 2 (setq t1 (/ (+ (* e 2.5) 75) 1.24)) ;; everything else ) (mode_tile "a" 2) (set_tile "res1" (rtos (if (> t1 t2) t2 t1) 2 2)) (set_tile "res2" "text text text") ) ) ; end cond ) ) ) ) (start_dialog) ) ) (*error* nil) )1 point
-
I am not the best at lisp routines but can edit them ok. Thanks for the lesson. I went online and found the syntax and edited it and now it is working well. (cons 1 (rtos (last cls) 2 0))1 point
-
@pkenewell the attribute holds an elevation, the pline is at say 0.0, so need to set the pline elevation 1st, as you have suggested once the pline has an elevation you could using your method set the attribute to the pline elevation field, that way change the pline value and atrribute updates, matches current sample dwg. You could check the attribute string to see if a field if not then update pline & attribute. We need @Civils_Ben to confirm the choice of method, how is the elevation first worked out and do you set pline or attribute ? Is it auto labelled, Civil software can do that sort of thing. Just a comment , you could use a lisp as every time you insert the elevation block must get the ID of the corresponding pline.1 point
-
There is software that draws lighting diagrams looking at a reflective value on say the ground these show the brightness at a point. a bit like a contour map of brightness. Were I worked we did a few lighting involved projects but we shopped out the light design. I would be very careful of using ACAD "LIGHTS" it will give you an idea but for a project like this need it properly analyzed. Very, very expensive if you get it wrong. Just a funny comment about sports ground lights, many years ago they built a major football stadium, it had multi lights for night games, so the powers to be decided it would be a good idea to turn on all the tower lights at the one time in a blaze of glory, well that lasted a couple of seconds, they sucked that much power they blacked out the entire neighborhood for 4 hours. Any one from Melbourne will know about Waverly stadium. Yes they did have night games turning on small banks one at a time.1 point
-
Using Tharwats code? Look at this section (setq txt (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") (cons 10 cls) (cons 1 (rtos (last cls) 2 2)) (cons 40 (* 0.00175 *MHY:Scale*)) (cons 8 "Contour Label") '(50 . 0.0) '(71 . 5) '(72 . 5) '(73 . 1) '(210 0.0 0.0 1.0) ) ) ) Add '(7 . "Text_Style") where text style is your font in between '(50 . ...) and '(71 . ...). Here using Standard text style: '(50 . 0.0) '(7 . "Standard") '(71 . 5) For height modify the (cons 40 (* 0.00175 *MHY@Scale*)) if necessary. Either change the 0.00175 to a different number or replace the whole (* 0.00175 *MHY:Scale*) to a value if you want the same height all the time eg. (cons 40 2.5)1 point
-
And if you use the command DVIEW? ((lambda ( / e_sel e pt_sel) (princ "\nSelect an object.") (cond ((setq e_sel (entsel)) (setq e (car e_sel) pt_sel (osnap (cadr e_sel) "_near")) (command "_.dview" e "" "_points" "_none" (list (car pt_sel) (cadr pt_sel) 0.0) "_none" (list (car pt_sel) (cadr pt_sel) 1.0) "" ) ) (T (princ "\nNothing selected.")) ) (prin1) ))1 point
-
@CivilTechSource you dont need to start a new topic this request can be added to your other post. Admin please merge into other post. Just a comment as your using multi if's it is probably better to start coding using a COND.1 point
-
I enjoy writing the programs and figure they are useless just sitting on my hard drive...1 point