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

0 Members and 1 Guest are viewing this topic.

AVCAD

  • Guest
New Challenge for you Code heads...
« on: May 11, 2007, 04:41:04 PM »
Ok, so I started coding this and quickly found my self lost. I believe i got a goods ways on it before going completly nuts and loseing all train of thought.

The UI is done its NOT very complicated. its the lsp that i am having trouble with.

the program should take the user input and and draw it out on the screen at a certain user defined placement (defined by clicking on screen). There are some calculations it should do to get some values based on user input.

Here is the link to a zip file I have of where I am at. I have included a CAD file in there too to somewhat explain what is needed.

http://www.theswamp.org/screens/index.php?dir=AVCAD/&file=VPGVA.zip

Anyhelp would be greatly appreciated. You guys helped me out awhile ago on differant program that i have been using for the last 2 years now.

Please feel free to ask anything. I would really like to get this program finished it woul dhelp out here a ton.

Thanks for the help future and past!
« Last Edit: May 11, 2007, 04:42:24 PM by AVCAD »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #1 on: May 11, 2007, 06:32:54 PM »
Quote from: Acad Comamnd Line
Command: vpgva
; error: no function definition: SET_SLIDE
What do you want drawn?  The puprle lines?

Edit:  I commeneted out the calls to the defun mentioned above.  Then I got this error.
Quote from: Acad Command LIne
Command: VPGVA
; error: no function definition: GET_DCL_PANEL
« Last Edit: May 11, 2007, 06:38:05 PM by T.Willey »
Tim

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

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #2 on: May 11, 2007, 07:43:02 PM »
Try this.
Code: [Select]
(defun c:Myvpgva (/ InsPt CaseWd CaseDp ScrWd ScrHt Dist MinDist MaxDist Ang ScList ProPt)

(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")
(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 "")
(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")
(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)
(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)
(command "_.line" ScLeft LrArcRtPt "")
(command "_.line" ScRight LrArcLtPt "")
(mapcar 'vla-Delete (list SmCirObj LrCirObj RtLineObj LfLineObj))
(setvar "osmode" oos)
)
;---------------------------------------------------------------------------------------------

(if
 (and
  (setq InsPt (getpoint "\n Select insertion point: "))
  (setq CaseWd (getdist "\n Enter width of casework: "))
  (setq CaseDp (getdist "\n Enter depth of casework: "))
  (setq ScrWd (getdist "\n Enter width of screen: "))
  (setq ScrHt (getdist "\n Enter height of screen: "))
  (setq Dist (getdist "\n Enter distance from screen to projector: "))
  (setq MinDist (getdist "\n Enter minimun view distance: "))
  (setq MaxDist (getdist "\n Enter maximum view distance: "))
  (setq Ang (getangle "\n Enter view angle: "))
  (DrawCasework CaseDp CaseWd InsPt)
  (setq ScList (DrawScreen CaseDp ScrWd InsPt))
  (setq ProPt (DrawProjector CaseDp Dist InsPt))
  (DrawCircles MinDist MaxDist Ang InsPt (car ScList) (cadr ScList))
 )
 (command "_.line" (car ScList) ProPt (cadr ScList) "")
)
(princ)
)
Tim

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

Please think about donating if this post helped you.

Fatty

  • Guest
Re: New Challenge for you Code heads...
« Reply #3 on: May 12, 2007, 04:13:33 AM »
Hi AVCAD
There is not clearly enough where are
your dimensions in the drawing
Better yet show all of these and
upload this drawing again
The more details you give, the easier it
is to understandand your problem.
What I have so far, it's framework only though

~'J'~
« Last Edit: May 12, 2007, 04:46:58 AM by Fatty »

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #4 on: May 14, 2007, 12:58:47 PM »
T.Willey:

You so got it. That is exactly what I want it to do, except that its is all command line. I would like that to work with the UI i have. your option for the max distance and min distance for the circles should be the multipler in the UI. that "multiplier" can be different for differant aspect ratio's of screens depending on what the screen will be used for. Then the max distance and min distance size would be dictated by the "multiplier" times the "Screen Height".

Everything else works perfectly. If it could jsut grab the info from the edit boxes in the DCL file it would be great. I am tried to work with it but I am really not that good at stuff....i can modify some stuff but I think this might be out of my range of knowledge.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #5 on: May 14, 2007, 02:49:36 PM »
If I get some time today I will have a look at this.  Do you just not know how to get the value from the edit boxes?  Is that what is holding you up?  If so, maybe this example will show you want to do.

Code: [Select]
(action_tile "accept"
 "(progn
   (setq EditBoxValue1 (get_tile \"EditBox01\"))
   (setq EditBoxValue2 (get_tile \"EditBox02\"))
   (setq EditBoxValue3 (get_tile \"EditBox03\"))
   (setq EditBoxValue4 (get_tile \"EditBox04\"))
   (done_dialog 1)
 )"
)

This will se the variables to the values in the edit boxes (maybe up keys).
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 #6 on: May 14, 2007, 06:04:17 PM »
http://www.theswamp.org/screens/index.php?dir=AVCAD/&file=VPGVA2.zip

I tried to get that to work with the sample code and some other copied code from other programs I had to get the DCL to load.

I got the DCL to load but it doesnt run through the rest of the routine. It just allows for userinput and then when you hit insert it just stops. ?? The slides dont load either in there. 1 other option I would like in here is when you click for the insertion point if you can click or type in a rotation angle too. Not sure how hard that would be to put in though.

Thank T for your help, I look forward to a reply again. As for me its off to the train now.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #7 on: May 14, 2007, 06:06:09 PM »
Try this one.
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 #8 on: May 15, 2007, 01:25:41 PM »
well that now loads the DCL but it when you hit insert it just sits there. I tried to work with code alittle more and now I have all the Slide images shown up and when I hit insert the box atleast disappears now lol...not sure if thats good or bad  :-o

I tried to get rod of some of the code I had in there was really pointless and didnt mean anything but reminders to myself also.

I tried to add in a function to get the multiplier to work as well, I am not sure if the code for it is right but it looks like it should work...the help menu doesnt really give too good of a base to work with...

Code: [Select]
(defun get_minmaxcirc ()
  (setq mincirc (* minvmulti ssheight))
  (setq maxcirc (* maxvmulti ssheight))
  )

Under your Mydrawpart I added

Code: [Select]
  (setq RotAn (getpoint "\n Select rotation angle: "))
Hopefully to be used for a rotation angle of what is drawn.

I changed some of the look of the DCL file too.

I have uploaded the changes I made so you can see and hopefully let me know if i am on the right track or fix what i have screwed up lol.

Thanks again for all the help.


<edit: code removed>

« Last Edit: May 16, 2007, 08:18:42 AM by CAB »

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #9 on: May 15, 2007, 01:29:57 PM »
crap i uploaded the wrong file above....

use this one

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #10 on: May 16, 2007, 10:19:52 AM »
hmm...hope I didnt stump anyone...I would really liek to get this to work. I wil play more iwth it today but I dont know how much further my ability will take me...

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #11 on: May 16, 2007, 01:38:44 PM »
ok, I am so stumpped here....I have the program loading and allowing for inputs into the editboxes in the UI, all the slides are showing up and are in the correct places.

But, when I hit accept...nothing. it just stops. It doesnt run throught the rest of the commands. ei. it doesnt draw what its suppose too.

I modified the GVA.dwg drawings to try to better show what I want drawn out when accept is selected as Fatty asked for.

T. Willey's Mygva.lsp does what I want too do, but I need it to work with the UI and have a selection for rotation angle, and for it not too ask for the minimum and maximum good viewing area circle radius but calc it by using a the useriputs for the multipliers.

ei. Min multiplier = 1.5, screen height = 72, 1.5X72=108, minimum good viewing area circle = 108R

I am attaching a Image here I hope that helps.

If you download this zip file attached the image will be in there along with the code and the dwg file I was speaking of.



T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #12 on: May 16, 2007, 01:53:53 PM »
I might have some time later today to play.  I didn't have any yesterday.  It's nice to see how the dialog is filled out though.
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 #13 on: May 16, 2007, 05:01:39 PM »
awesome thanks. I look forward to a reply. In the mean time I will keep trying to figure this out but I think i am running in circles...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #14 on: May 16, 2007, 06:01:36 PM »
This works, but the rotation doesn't do anything.  Is it supposed to rotate the whole thing?  If so that wouldn't be to hard to add.
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 #15 on: May 17, 2007, 10:23:43 AM »
yes it should rotate the whole thing. I will download this and check it out

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #16 on: May 17, 2007, 03:40:37 PM »
WoW! Works great. After talking with some guys here and going over "design" Standards....They dont want to give people the oppertunity to input the wrong multiplier....so they asked me to add radio buttons for the "standard" options but leave an "other" feature so that if there is an oddball we can still use it.

Some changes that were made.

I added it to the DCL file and added/updated these keys

Code: [Select]
gvaothr1     - radio button for user defined input - talks to min100   [color=red](new)[/color]
gvaothr2     - radio button for user defined input - talks to max100   [color=red](new)[/color]
gvaothr3 - radio button for user defined input - talks to ang100   [color=red](new)[/color]
gva1 - radio button for minimum multiplier - default too 1.125   [color=red](new)[/color]
gva4 - radio button for maximum multiplier - default too 4   [color=red](new)[/color]
gva6 - radio button for maximum multiplier - default too 6   [color=red](new)[/color]
gva8 - radio button for maximum multiplier - default too 8   [color=red](new)[/color]
gva60 - radio button for default angle of gva - default too 60 degrees   [color=red](new)[/color]

The calculation for the "mincirc" variable was changed to "min100 * ss100" (thats the multiplier times the screen width now instead of the height)

I wanted these new variables too work like a activation button...like they select the button and the the edit box becomes active, and what ever was entered in the edit box would then be considered the variable to be used in the drawing of the items.

Code: [Select]
gvaothr1
gvaothr2
gvaothr3

The buttons related too:

Code: [Select]
gva1
gva4
gva6
gva8

are for the radio buttons on the UI. These should be used to have default vaules instead of the user defined one. But the "gvaothr#" related buttons should still be availble to use of needed.

as in my last post, yes the rotation angle should just rotate the entire thing.

I cant thank you enought for your help here. Its is very appreciated.

I have uploaded the dcl and lsp files again.



T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #17 on: May 17, 2007, 05:09:07 PM »
I don't have time today, and tonight I'm going out of town, so I won't be able to work on this until next week (if work allows).  Sorry.

Maybe someone else will jump in.
Tim

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

Please think about donating if this post helped you.

lispman21

  • Guest
Re: New Challenge for you Code heads...
« Reply #18 on: May 18, 2007, 09:21:42 AM »
Try this code out it may be what you are looking for

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #19 on: May 18, 2007, 10:07:59 AM »
I don't have time today, and tonight I'm going out of town, so I won't be able to work on this until next week (if work allows).  Sorry.

Maybe someone else will jump in.

Thats cool, I appreciate all your help. I will keep working on it and see what happens. Hopefully you can get some time soon and we can finish it...its sooo close!!

I got a cubs sox game to go to at noon!

oh ya...Lispman21... I will check it out.

AVCAD

  • Guest
Re: New Challenge for you Code heads...
« Reply #20 on: May 21, 2007, 12:29:43 PM »
Lispman21,

Yes it does grey it out untill it is checked, but if you select something else it stays active. When it is not selected it should go back to grey so there is no userinput in the edit box.

I will look more at it later I have some actual work on my desk right now :-)

Hope hear from you guys soon :-)


lispman21

  • Guest
Re: New Challenge for you Code heads...
« Reply #21 on: May 21, 2007, 03:16:24 PM »
This one should take care of the edit box staying ative when not selected.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #22 on: May 21, 2007, 03:39:51 PM »
Here is one that will rotate it per what you want.
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 #23 on: May 21, 2007, 05:35:58 PM »
sweet that worked great T.

Now the last thing is just to get the radio buttons to work correctly. I have been tring to get it too work but I just cant figure it out.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #24 on: May 21, 2007, 06:01:54 PM »
Here are the two files that work.  If not selected 'user defined' the edit boxes will be greyed out.  Any more mods you will have to do yourself.   :wink:
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 #25 on: May 22, 2007, 01:52:43 PM »
thanks for all the help T.

Although I am running circles here with these damn radio buttons.

I think I have to set up conditions for the buttons but it isnt working for me.

I have tried:

Code: [Select]
(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 ang100 (* pi (/ (distof (get_tile "ang100")) 180)))
(done_dialog 1)
)

(defun get_radiobuttons ()
  (cond
    ((= gva60b "1") (setq ang100 (* pi (/ (gva60))) 180))
    ((= gvaothr3 "1") (setq ang100 (* pi (/ (distof (get_tile "ang100")) 180))))
    )
  (cond
    ((= gva1b "1") (setq minc (gva1)))
    ((= gvaothr1 "1") (setq minc (distof (get_tile "min100"))))
      )
  (cond
    ((= gva4b "1") (setq maxc (gva4)))
    ((= gva6b "1") (setq maxc (gva6)))
    ((= gva8b "1") (setq maxc (gva8)))
    ((= gvaothr2 "1") (setq maxc (distof (get_tile "min100"))))
      )
  )

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

and...

Code: [Select]
(defun get_radiobuttons ()
  (cond
    (if (= $value "gva60b") (setq ang100 (* pi (/ (gva60))) 180))
    (if (= $value "gvaothr3") (setq ang100 (* pi (/ (distof (get_tile "ang100")) 180))))
    )
  (cond
    (if (= $value "gva1b") (setq minc (gva1)))
    (if (= $value "gvaothr1") (setq minc (distof (get_tile "min100"))))
      )
  (cond
    (if (= $value "gva4b") (setq maxc (gva4)))
    (if (= $value "gva6b") (setq maxc (gva6)))
    (if (= $value "gva8b") (setq maxc (gva8)))
    (if (= $value "gvaothr2") (setq maxc (distof (get_tile "max100"))))
      )
  )

Neither have worked. Am I atleast on the right track for this???

T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #26 on: May 22, 2007, 02:24:44 PM »
Did you notice that I had to change you dcl file a little?  I have to add a key value to the radio columns so that I could tell which radio was pressed.  This will help you get what you want, as it returns the key for the radio pressed.  Then you can check to see if it is user specified, and if so get the edit box instead of the on of the radio buttons.

Hope that helps.
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 #27 on: May 22, 2007, 03:02:42 PM »
Ya, I added

Code: [Select]
  (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"))

and now each one will return a 1 or 0 based on which radio button is selected

So from there I came up with:

Code: [Select]
(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 ()
  (cond
    ((= gva1b "1") (setq minc (gva1)))
    ((= gvaothr1 "1") (setq minc (distof (get_tile "min100"))))
      )
  (cond
    ((= gva4b "1") (setq maxc (gva4)))
    ((= gva6b "1") (setq maxc (gva6)))
    ((= gva8b "1") (setq maxc (gva8)))
    ((= gvaothr2 "1") (setq maxc (distof (get_tile "min100"))))
      )
  (cond
    ((= gva60b "1") (setq ang100 (* pi (/ (gva60))) 180))
    ((= gvaothr3 "1") (setq ang100 (* pi (/ (distof (get_tile "ang100")) 180))))
    )
  )

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

I was hoping that with the condition set it would work but wont. There has too be somethign wrong with the code I just dont know what. Like I said I am not that good at this, but I am learning.


T.Willey

  • Needs a day job
  • Posts: 5251
Re: New Challenge for you Code heads...
« Reply #28 on: May 22, 2007, 03:24:04 PM »
A quick look.  Here
Code: [Select]
(defun get_radiobuttons ()
  (cond
    ((= gva1b "1") (setq minc (gva1)))
    ((= gvaothr1 "1") (setq minc (distof (get_tile "min100"))))
      )
  (cond
    ((= gva4b "1") (setq maxc (gva4)))
    ((= gva6b "1") (setq maxc (gva6)))
    ((= gva8b "1") (setq maxc (gva8)))
    ((= gvaothr2 "1") (setq maxc (distof (get_tile "min100"))))
      )
  (cond
    ((= gva60b "1") (setq ang100 (* pi (/ (gva60))) 180))
    ((= gvaothr3 "1") (setq ang100 (* pi (/ (distof (get_tile "ang100")) 180))))
    )
  )
You need to take the parens out that surround the 'gva#'.  They are variables not functions.  See if that gets you going.
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 #29 on: May 22, 2007, 05:03:13 PM »
Ok so i took out the () like you said and I changed alittle bit of the code

Code: [Select]
(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))
  )

instead of calling out a seperate variable i just called what that varible should be...1.125, 4, 6, 8, 60...

I changed the ang100 variable here to becalled anggva so that it could be called later.

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

I also made sure to change that call in

Code: [Select]
(DrawCircles mincirc maxcirc anggva InsPt (car ScList) (cadr ScList))
Yet still got no where....I must be missing something, cause anggva, minc, and maxc are all coming up nil when the program runs.

Should it not be a condition statement? maybe a If statement? if it is then I an lost cause i dont know the if statement code and I have looked online but there are no good examples I have found.

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.