Author Topic: New Challenge for you Code heads...  (Read 9200 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #30 on: May 22, 2007, 05:15:46 PM »
This is wrong
Code: [Select]
((= gva60b 1) (setq anggva (* pi (/ 60)) 180))should be
Code: [Select]
((= gva60b 1) (setq anggva (* pi (/ 60 180))))
You need to post the whole code so that we can see where things are to make sure they are in the correct order.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #31 on: May 22, 2007, 05:39:53 PM »
I changed what you said was wrong but it still doesnt work. My head is pounding... :-o

LSP code:

Code: [Select]
(defun c:vpgva ( / dcl_id)

  (setq ss (ssadd))
  ;;----------------------dcl stuff-----------------------------
  (setq dcl_id (load_dialog "vpgva.dcl"))
  (if (not (new_dialog "vpgva" dcl_id))
    (exit)   
  )

  ;; start code: slide files
  (start_image "csimage")
  (setq xx (dimx_tile "csimage"))
  (setq yy (dimy_tile "csimage"))
  (slide_image
    15 0 xx yy "csimage")
  (end_image)

  ;; start code: slide files
  (start_image "ssimage")
  (setq xx (dimx_tile "ssimage"))
  (setq yy (dimy_tile "ssimage"))
  (slide_image
    30 0 xx yy "ssimage")
  (end_image)

  ;; start code: slide files
  (start_image "vpimage")
  (setq xx (dimx_tile "vpimage"))
  (setq yy (dimy_tile "vpimage"))
  (slide_image
    0 0 xx yy "vpimage")
  (end_image)

  (mode_tile "min100" 1)
  (mode_tile "max100" 1)
  (mode_tile "ang100" 1)
  (mode_tile "cs101" 2)

  (action_tile "accept" "(mydone_dialog)")
  (action_tile "cancel" "(done_dialog) (setq UserClick nil)")
  (action_tile "MinView" "(if (= $value \"gvaothr1\") (mode_tile \"min100\" 0) (mode_tile \"min100\" 1))")
  (action_tile "MaxView" "(if (= $value \"gvaothr2\") (mode_tile \"max100\" 0) (mode_tile \"max100\" 1))")
  (action_tile "GoodView" "(if (= $value \"gvaothr3\") (mode_tile \"ang100\" 0) (mode_tile \"ang100\" 1))")

  (start_dialog)

  (unload_dialog dcl_id)
  (prompt "\nRunning...")
  (if UserClick
    (MyDrawPart)
  )
  (princ)
)

;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;;             End Of Main Routine             
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;; X =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= X
;; X =          S u b  R o u t i n e s           = X
;; X =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= X
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

;;-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
(defun mydone_dialog ()
  (get_userinput)
  (get_minmaxcirc)
  (get_radiobuttons)
  (setq UserClick T)
)

;;-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
;; gets variables set from dialog box
(defun get_userinput ()
  (setq cs100 (distof (get_tile "cs100")))
  (setq cs101 (distof (get_tile "cs101" )))
  (setq ss100 (distof (get_tile "ss100")))
  (setq ss101 (distof (get_tile "ss101")))
  (setq vp100 (distof (get_tile "vp100")))
  (setq min100 (distof (get_tile "min100")))
  (setq max100 (distof (get_tile "max100")))
;;  (setq gva1 (* 1 1.125))
;;  (setq gva4 (* 1 4))
;;  (setq gva6 (* 1 6))
;;  (setq gva8 (* 1 8))
;;  (setq gva60 (* 1 60))
  (setq gvaothr1 (get_tile "gvaothr1")) 
  (setq gva1b (get_tile "gva1b"))
  (setq gvaothr2 (get_tile "gvaothr2"))
  (setq gva4b (get_tile "gva4b"))
  (setq gva6b (get_tile "gva6b"))
  (setq gva8b (get_tile "gva8b"))
  (setq gvaothr3 (get_tile "gvaothr3"))     
  (setq gva60b (get_tile "gva60b"))
  (setq ang100 (* pi (/ (distof (get_tile "ang100")) 180)))
(done_dialog 1)
)

(defun get_radiobuttons (minc maxc anggva)
  (cond
    ((= gvaothr1 1) (setq minc min100))
    ((= gva1b 1) (setq minc 1.125))
    )
  (cond
    ((= gvaothr2 1) (setq maxc max100))
    ((= gva4b 1) (setq maxc 4))
    ((= gva6b 1) (setq maxc 6))
    ((= gva8b 1) (setq maxc 8))
      )
  (cond
    ((= gvaothr3 1) (setq anggva ang100))   
    ((= gva60b 1) (setq anggva (* pi (/ 60 180))))
      )
  )

(defun get_minmaxcirc ()
  (setq mincirc (* minc ss100))
  (setq maxcirc (* maxc ss101))
  )

(defun MyDrawPart ()
  (setq InsPt (getpoint "\n Select insertion point: "))
  (setq RotAn (getangle "\n Select rotation angle: "))
  (DrawCasework cs100 cs101 InsPt)
  (setq ScList (DrawScreen cs100 ss100 InsPt))
  (setq ProPt (DrawProjector cs100 vp100 InsPt))
  (DrawCircles mincirc maxcirc anggva InsPt (car ScList) (cadr ScList))
  (command "_.pline" "_non" (car ScList) "_non" ProPt "_non" (cadr ScList) "")
  (ssadd (entlast) ss)
  (command "_.rotate" ss "" InsPt (* 180.0 (/ RotAn pi)))
)

(defun DrawCasework (Depth Width StPt / oos ul ur temPt ll lr)

(setq oos (getvar "osmode"))
(setq ul (polar StPt pi (/ Width 2.0))
 ur (polar StPt 0.0 (/ Width 2.0))
 tempPt (polar StPt (* pi 1.5) Depth)
 ll (polar tempPt pi (/ Width 2.0))
 lr (polar tempPt 0.0 (/ Width 2.0))
)
(setvar "osmode" 0)
(command "_.pline" ul ur lr ll "_c")
(ssadd (entlast) ss)
(setvar "osmode" oos)
)
;--------------------------------------------------------------------------------
(defun DrawScreen (Depth Width StPt / oos tempPt Left Right)

(setq oos (getvar "osmode"))
(setq tempPt (polar StPt (* pi 1.5) (/ Depth 2.0))
 Left (polar tempPt pi (/ Width 2.0))
 Right (polar tempPt 0.0 (/ Width 2.0))
)
(setvar "osmode" 0)
(command "_.pline" Left Right "")
(ssadd (entlast) ss)
(setvar "osmode" oos)
(list Left Right)
)
;-----------------------------------------------------------------------------------
(defun DrawProjector (Depth Dist StPt / oos ul ur tempPt ll lr)

(setq oos (getvar "osmode"))
(setq tempPt (polar StPt (* pi 1.5) (+ Dist (/ Depth 2.0)))
 ul (polar tempPt pi 6.75)
 ur (polar tempPt 0.0 6.75)
 ll (polar ul (* pi 1.5) 13.5)
 lr (polar ur (* pi 1.5) 13.5)
)
(setvar "osmode" 0)
(command "_.pline" ul ur lr ll "_c")
(ssadd (entlast) ss)
(setvar "osmode" oos)
tempPt
)
;--------------------------------------------------------------------------------------
(defun DrawCircles (MinRad MaxRad Ang StPt ScLeft ScRight / oos SmCirObj LrCirObj RtLineObj LfLineObj SmArcRtPt SmArcPtPt
                                                            LrArcRtPt LrArcLtPt)

(setq oos (getvar "osmode"))
(setvar "osmode" 0)

(command "_.circle" StPt MinRad)
(setq SmCirObj (vlax-ename->vla-object (entlast)))

(command "_.circle" StPt MaxRad)
(setq LrCirObj (vlax-ename->vla-object (entlast)))

(command "_.line" ScRight (polar ScRight (+ pi (- (* pi 0.5) Ang)) (* MaxRad 2.0)) "")
(setq RtLineObj (vlax-ename->vla-object (entlast)))

(command "_.line" ScLeft (polar ScLeft (+ (* pi 1.5) Ang) (* MaxRad 2.0)) "")
(setq LfLineObj (vlax-ename->vla-object (entlast)))

(setq SmArcRtPt (vlax-invoke SmCirObj 'IntersectWith LfLineObj acExtendNone))
(setq SmArcLtPt (vlax-invoke SmCirObj 'IntersectWith RtLineObj acExtendNone))

(command "_.arc" SmArcLtPt (polar StPt (* pi 1.5) MinRad) SmArcRtPt)
(ssadd (entlast) ss)

(setq LrArcRtPt (vlax-invoke LrCirObj 'IntersectWith LfLineObj acExtendNone))
(setq LrArcLtPt (vlax-invoke LrCirObj 'IntersectWith RtLineObj acExtendNone))

(command "_.arc" LrArcLtPt (polar StPt (* pi 1.5) MaxRad) LrArcRtPt)
(ssadd (entlast) ss)

(command "_.line" ScLeft LrArcRtPt "")
(ssadd (entlast) ss)
(command "_.line" ScRight LrArcLtPt "")
(ssadd (entlast) ss)

(mapcar 'vla-Delete (list SmCirObj LrCirObj RtLineObj LfLineObj))
(setvar "osmode" oos)
)
(princ)

DCL Code:

Code: [Select]
vpgva : dialog
{
label = "Projection Screen GVA:";
: row {                             
: boxed_column {                       
          label = "Case Size:";            
: image {                                 
         key = "csimage" ;             
         color = 0;
         aspect_ratio = 1.25;       
         width = 25;
         }                               
: edit_box {                         
          label = "Depth:";
          key = "cs100";
          edit_width = 5;
          edit_limit = 10;
          fixed_width = false;
          is_tab_stop = true;
  value = 5.25;         
          }                               
: edit_box {                               
          label = "Width:";
          key = "cs101";
          edit_width = 5;
          edit_limit = 10;
          fixed_width = false;
          is_tab_stop = true;
          value = 0;
          }                           
}
: boxed_column {                           
          label = "Screen Size:";       
: image {                                 
         key = "ssimage" ;
         color = 0;
         aspect_ratio = 1.25;
         width = 25;
         }
: edit_box {                         
          label = "Width:";
          key = "ss100";
          edit_width = 5;
          edit_limit = 10;
          fixed_width = false;
          is_tab_stop = true;         
          }                           
: edit_box {                       
          label = "Height:";
          key = "ss101";
          edit_width = 5;
          edit_limit = 10;
          fixed_width = false;
          is_tab_stop = true;         
          }                           
}
}

: row {                                 
: boxed_column {                       
          label = "Projector Distance:";
: image {                                   
        key = "vpimage" ;
        color = 0;
        aspect_ratio = 1;
        width = 70;
        height = 1;
        }                         
: edit_box {                           
          label = "Distance from Screen to Lens:";
          key = "vp100";
          edit_width = 5;
          edit_limit = 10;
          fixed_width = false;
          is_tab_stop = true;
  value = 144;         
          }                                   
         }
: column {             
  fixed_height = true;
: boxed_radio_column {
  label = "Minimum Viewing Distance Multiplier: (Multipled x Image Width)";
          key = "MinView";
: radio_button {
  label = "1.125 - General Viewing";
  key = "gva1b";
  is_tab_stop = true;
  value = 1;  
  }
: radio_button {
          label = "User defined multiplier:";
          key = "gvaothr1";
  is_tab_stop = true;
          }
: edit_box {                         
          key = "min100";
          edit_width = 5;
          edit_limit = 10;
          fixed_width = true;
          is_tab_stop = true;
          }                                 
          }
: boxed_radio_column {
  label = "Maximum Viewing Distance Multiplier: (Multipled x Image Height)";
          key = "MaxView";
: radio_button {
  label = "4 - Inspection Viewing";
  key = "gva4b";
  is_tab_stop = true;
  }
: radio_button {
  label = "6 - Detailed Viewing";
  key = "gva6b";
  is_tab_stop = true;
  value = 1;
  }
: radio_button {
  label = "8 - General Viewing";
  key = "gva8b";
  is_tab_stop = true;
  }
: radio_button {                               
          label = "User defined multiplier:";
          key = "gvaothr2";
          is_tab_stop = true;
          }
: edit_box {         
          key = "max100";
          edit_width = 5;
          edit_limit = 10;
          fixed_width = true;
          is_tab_stop = true;         
          }                                 
          }
: boxed_radio_column {
  label = "Good Viewing Area Cone:";
          key = "GoodView";
: radio_button {
  label = "Default 60°";
  key = "gva60b";
  is_tab_stop = true;
  value = 1;  
  }
: radio_button {                               
          label = "User defined angle:";
          key = "gvaothr3";
  is_tab_stop = true;         
          }
      :edit_box {
          key = "ang100";
          edit_width = 5;
          edit_limit = 5;
          fixed_width = true;
          is_tab_stop = true;
          }
          }                                   
}
}
: row {                                   
  : button {                                 
          label ="&Accept";
          key ="accept";
          is_default = true;
          fixed_width = false;
          }                                   
  : cancel_button {                             
          label = "&Cancel";
          is_cancel = true;
          fixed_width = false;       
          }                                     
}                                             
: row {
  : text {
label = ""; 
     }
     }
}                                           

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #32 on: May 22, 2007, 05:57:14 PM »
Try this quick fix.
Code: [Select]
(defun c:vpgva ( / dcl_id)

  (setq ss (ssadd))
  ;;----------------------dcl stuff-----------------------------
  (setq dcl_id (load_dialog "vpgva.dcl"))
  (if (not (new_dialog "vpgva" dcl_id))
    (exit)   
  )

  ;; start code: slide files
  (start_image "csimage")
  (setq xx (dimx_tile "csimage"))
  (setq yy (dimy_tile "csimage"))
  (slide_image
    15 0 xx yy "csimage")
  (end_image)

  ;; start code: slide files
  (start_image "ssimage")
  (setq xx (dimx_tile "ssimage"))
  (setq yy (dimy_tile "ssimage"))
  (slide_image
    30 0 xx yy "ssimage")
  (end_image)

  ;; start code: slide files
  (start_image "vpimage")
  (setq xx (dimx_tile "vpimage"))
  (setq yy (dimy_tile "vpimage"))
  (slide_image
    0 0 xx yy "vpimage")
  (end_image)

  (mode_tile "min100" 1)
  (mode_tile "max100" 1)
  (mode_tile "ang100" 1)
  (mode_tile "cs101" 2)

  (action_tile "accept" "(mydone_dialog)")
  (action_tile "cancel" "(done_dialog) (setq UserClick nil)")
  (action_tile "MinView" "(if (= $value \"gvaothr1\") (mode_tile \"min100\" 0) (mode_tile \"min100\" 1))")
  (action_tile "MaxView" "(if (= $value \"gvaothr2\") (mode_tile \"max100\" 0) (mode_tile \"max100\" 1))")
  (action_tile "GoodView" "(if (= $value \"gvaothr3\") (mode_tile \"ang100\" 0) (mode_tile \"ang100\" 1))")

  (start_dialog)

  (unload_dialog dcl_id)
  (prompt "\nRunning...")
  (if UserClick
    (MyDrawPart)
  )
  (princ)
)

;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
;;             End Of Main Routine             
;;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;; X =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= X
;; X =          S u b  R o u t i n e s           = X
;; X =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= X
;; XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

;;-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
(defun mydone_dialog ()
  (get_userinput)
  (get_radiobuttons)
  (get_minmaxcirc)
  (setq UserClick T)
)

;;-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
;; gets variables set from dialog box
(defun get_userinput ()
  (setq cs100 (distof (get_tile "cs100")))
  (setq cs101 (distof (get_tile "cs101" )))
  (setq ss100 (distof (get_tile "ss100")))
  (setq ss101 (distof (get_tile "ss101")))
  (setq vp100 (distof (get_tile "vp100")))
  (setq min100 (get_tile "min100"))
  (setq max100 (get_tile "max100"))
;;  (setq gva1 (* 1 1.125))
;;  (setq gva4 (* 1 4))
;;  (setq gva6 (* 1 6))
;;  (setq gva8 (* 1 8))
;;  (setq gva60 (* 1 60))
  (setq gvaothr1 (get_tile "gvaothr1")) 
  (setq gva1b (get_tile "gva1b"))
  (setq gvaothr2 (get_tile "gvaothr2"))
  (setq gva4b (get_tile "gva4b"))
  (setq gva6b (get_tile "gva6b"))
  (setq gva8b (get_tile "gva8b"))
  (setq gvaothr3 (get_tile "gvaothr3"))     
  (setq gva60b (get_tile "gva60b"))
  (setq ang100 (get_tile "ang100"))
(done_dialog 1)
)

(defun get_radiobuttons ()
  (cond
    ((= gvaothr1 "1") (setq minc (distof min100)))
    ((= gva1b "1") (setq minc 1.125))
    )
  (cond
    ((= gvaothr2 "1") (setq maxc (distof max100)))
    ((= gva4b "1") (setq maxc 4))
    ((= gva6b "1") (setq maxc 6))
    ((= gva8b "1") (setq maxc 8))
      )
  (cond
    ((= gvaothr3 "1") (setq anggva (* pi (/ (distof ang100) 180))))   
    ((= gva60b "1") (setq anggva (* pi (/ 60 180))))
      )
  )

(defun get_minmaxcirc ()
  (setq mincirc (* minc ss100))
  (setq maxcirc (* maxc ss101))
  )

(defun MyDrawPart ()
  (setq InsPt (getpoint "\n Select insertion point: "))
  (setq RotAn (getangle "\n Select rotation angle: "))
  (DrawCasework cs100 cs101 InsPt)
  (setq ScList (DrawScreen cs100 ss100 InsPt))
  (setq ProPt (DrawProjector cs100 vp100 InsPt))
  (DrawCircles mincirc maxcirc anggva InsPt (car ScList) (cadr ScList))
  (command "_.pline" "_non" (car ScList) "_non" ProPt "_non" (cadr ScList) "")
  (ssadd (entlast) ss)
  (command "_.rotate" ss "" InsPt (* 180.0 (/ RotAn pi)))
)

(defun DrawCasework (Depth Width StPt / oos ul ur temPt ll lr)

(setq oos (getvar "osmode"))
(setq ul (polar StPt pi (/ Width 2.0))
 ur (polar StPt 0.0 (/ Width 2.0))
 tempPt (polar StPt (* pi 1.5) Depth)
 ll (polar tempPt pi (/ Width 2.0))
 lr (polar tempPt 0.0 (/ Width 2.0))
)
(setvar "osmode" 0)
(command "_.pline" ul ur lr ll "_c")
(ssadd (entlast) ss)
(setvar "osmode" oos)
)
;--------------------------------------------------------------------------------
(defun DrawScreen (Depth Width StPt / oos tempPt Left Right)

(setq oos (getvar "osmode"))
(setq tempPt (polar StPt (* pi 1.5) (/ Depth 2.0))
 Left (polar tempPt pi (/ Width 2.0))
 Right (polar tempPt 0.0 (/ Width 2.0))
)
(setvar "osmode" 0)
(command "_.pline" Left Right "")
(ssadd (entlast) ss)
(setvar "osmode" oos)
(list Left Right)
)
;-----------------------------------------------------------------------------------
(defun DrawProjector (Depth Dist StPt / oos ul ur tempPt ll lr)

(setq oos (getvar "osmode"))
(setq tempPt (polar StPt (* pi 1.5) (+ Dist (/ Depth 2.0)))
 ul (polar tempPt pi 6.75)
 ur (polar tempPt 0.0 6.75)
 ll (polar ul (* pi 1.5) 13.5)
 lr (polar ur (* pi 1.5) 13.5)
)
(setvar "osmode" 0)
(command "_.pline" ul ur lr ll "_c")
(ssadd (entlast) ss)
(setvar "osmode" oos)
tempPt
)
;--------------------------------------------------------------------------------------
(defun DrawCircles (MinRad MaxRad Ang StPt ScLeft ScRight / oos SmCirObj LrCirObj RtLineObj LfLineObj SmArcRtPt SmArcPtPt
                                                            LrArcRtPt LrArcLtPt)

(setq oos (getvar "osmode"))
(setvar "osmode" 0)

(command "_.circle" StPt MinRad)
(setq SmCirObj (vlax-ename->vla-object (entlast)))

(command "_.circle" StPt MaxRad)
(setq LrCirObj (vlax-ename->vla-object (entlast)))

(command "_.line" ScRight (polar ScRight (+ pi (- (* pi 0.5) Ang)) (* MaxRad 2.0)) "")
(setq RtLineObj (vlax-ename->vla-object (entlast)))

(command "_.line" ScLeft (polar ScLeft (+ (* pi 1.5) Ang) (* MaxRad 2.0)) "")
(setq LfLineObj (vlax-ename->vla-object (entlast)))

(setq SmArcRtPt (vlax-invoke SmCirObj 'IntersectWith LfLineObj acExtendNone))
(setq SmArcLtPt (vlax-invoke SmCirObj 'IntersectWith RtLineObj acExtendNone))

(command "_.arc" SmArcLtPt (polar StPt (* pi 1.5) MinRad) SmArcRtPt)
(ssadd (entlast) ss)

(setq LrArcRtPt (vlax-invoke LrCirObj 'IntersectWith LfLineObj acExtendNone))
(setq LrArcLtPt (vlax-invoke LrCirObj 'IntersectWith RtLineObj acExtendNone))

(command "_.arc" LrArcLtPt (polar StPt (* pi 1.5) MaxRad) LrArcRtPt)
(ssadd (entlast) ss)

(command "_.line" ScLeft LrArcRtPt "")
(ssadd (entlast) ss)
(command "_.line" ScRight LrArcLtPt "")
(ssadd (entlast) ss)

(mapcar 'vla-Delete (list SmCirObj LrCirObj RtLineObj LfLineObj))
(setvar "osmode" oos)
)
(princ)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #33 on: May 23, 2007, 11:22:22 AM »
ok...now I am getting some where....i hate code...could be your best friend when it works and your worse nightmere when it doesnt....

I had to also switch

Code: [Select]
(defun mydone_dialog ()
  (get_userinput)
  (get_minmaxcirc)
  (get_radiobuttons)
  (setq UserClick T)
)


too..

Code: [Select]
(defun mydone_dialog ()
  (get_userinput)
[b](get_radiobuttons)[/b]
  (get_minmaxcirc)
  (setq UserClick T)
)

I guess it needed to that before the minmax one...

I also had to change..

Code: [Select]
(setq min100 (distof (get_tile "min100")))
  (setq max100 (distof (get_tile "max100")))

too..

Code: [Select]
(setq min100 (get_tile "min100")))
  (setq max100 (get_tile "max100")))

why it had to change I really dont know but my thought is because it you changed

Code: [Select]
((= gvaothr1 1) (setq minc min100))
too..

Code: [Select]
((= gvaothr1 1) (setq minc (distof min100)))
I only had to "get" the variable the 1st time then call out for a distance.

I had to comment out this line

Code: [Select]
(setq ang100 (* pi (/ (distof (get_tile "ang100")) 180)))
cause the wasnt working. once I commented it out the program worked...sort of...which brings me to the last problem....

Code: [Select]
  (cond
    ((= gvaothr3 "1") (setq anggva (* pi (/ (distof ang100) 180))))   
    ((= gva60b "1") (setq anggva (* pi (/ 60 180))))
      )

that part is not working. it keeps setting the anggva variable to 0.0 when the radio button is selected. and if I select the userdefined button it doesnt work at all.

I have uploaded the current files I have with the changes above, if you want to take alook. I will continue to work on it and try to figure this one out.




AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #34 on: May 23, 2007, 11:24:24 AM »
omg...i just realized there were more changes in your fix then I caught...

what a moron...let me check this again...

edit...

lol the changed i made above you made too :-) see so I am learning!

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #35 on: May 23, 2007, 11:29:27 AM »
omg...i just realized there were more changes in your fix then I caught...

what a moron...let me check this again...

edit...

lol the changed i made above you made too :-) see so I am learning!
I was thinking that those changes are the ones I made (glad to see you are understand the code better).  I guess you made them before I posted mine, or before you saw what I posted.  I will take a look at the code when I get a chance.  Today is a half day, dentist, so "real" work might get in the way.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #36 on: May 23, 2007, 12:00:14 PM »
This part of the angle code doesnt work right...I dont know why the math doesnt come up right

Code: [Select]
((= gva60b "1") (setq anggva (* pi (/ 60 180))))
Here is a result of the it. anggva is set to 0.0 for some reason...



I tried to change it to the actual rotation number in the code instead of using a math fuction.

Code: [Select]
((= gva60b "1") (setq anggva 330))
The angle should be 60degrees but the way the rest of the code is writen it needs to be 330 so its rotated correctly. the end result should be 60 degrees from the correct point.

but...when it ran the angle comes out wrong, but the varible is set correctly.


T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #37 on: May 23, 2007, 12:07:06 PM »
try this instead.
Code: [Select]
((= gva60b "1") (setq anggva (* pi (/ 60 180.0))))
If you don't put a real in there, then it will return an integer instead.  This will return 1.0472 now.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #38 on: May 23, 2007, 12:07:22 PM »
well... I think I fixed it...

Code: [Select]
    ((= gva60b "1") (setq anggva (* pi 0.3333333)))
I just did the math manually and skipped the whole (/ 60 180) in the code..

60 divided by 180 is 0.3333 (repeating)

so I just put that number in as the constant and then multipled by pi...seems to work.

I will need to test it more.

Btw...sorry for all the posts :-)

And thank you to everyone who helped me out on this. It is very appreciated.

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #39 on: May 23, 2007, 12:09:26 PM »
try this instead.
Code: [Select]
((= gva60b "1") (setq anggva (* pi (/ 60 180.0))))
If you don't put a real in there, then it will return an integer instead.  This will return 1.0472 now.

ya that worked too....errrr!! a damn decimal point...code is so aggrivating sometimes lol.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: New Challenge for you Code heads...
« Reply #40 on: May 23, 2007, 12:13:08 PM »
AVCAD
Be sure you understand what Tim said about using a REAL number instead of an INTEGER.
The first example is an integer only operation. The others use a real number.

Code: [Select]
Command: (/ 5 2)


Command: (/ 5. 2)
2.5

Command: (/ 5 2.)
2.5
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #41 on: May 23, 2007, 02:32:10 PM »
I would like to thank you again for all your help on this. The program is Finished. I completed it with layering and color information and changed some _.line code to _.pline so that I could add width information to it. And finalized some of the calculation code.

Thank you again for all your help on this and anything I have in the future. You guys Rock!  :mrgreen:

Attached is the "Final" release of it. Really being the 1st working version lol. If any of you guys out there are designing AV systems and have to drop in some Projection screens this will help you out.

Let me know if you like it.

I uploaded the Original Unprotected Code. Feel free to customize it for you company if you use it.


T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #42 on: May 23, 2007, 02:41:09 PM »
Glad it finally is done, and working the way you want it to.  Glad I could help, and I hope you got a better understand of Lisp and dcl from this experience.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.