Author Topic: New Challenge for you Code heads...  (Read 9205 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.