Author Topic: grread + ortho  (Read 9866 times)

0 Members and 1 Guest are viewing this topic.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: grread + ortho
« Reply #15 on: February 11, 2009, 03:31:28 PM »

A quick note
Code: [Select]
(if (not (setq TrussID (strcase (getstring "\n Enter truss identifier: <A>"))))
(setq TrussID "A")
)
This will never put the default as ' A '.  ' getstring ' will never return nil.  If enter is pressed, it returns an empty string ' "" ', so test to see ' TrussID ' equals that, and if so then default to ' A '.


Yeah I saw that, Yet I was more worried about getting everything else to work first,  It need to check for "" instead.

Thanks for the catch, I'll give this a go.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

T.Willey

  • Needs a day job
  • Posts: 5251
Re: grread + ortho
« Reply #16 on: February 11, 2009, 06:06:34 PM »
So do you still need help?
Tim

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

Please think about donating if this post helped you.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: grread + ortho
« Reply #17 on: February 11, 2009, 07:54:38 PM »
So do you still need help?

Let me look at it and get back to you in the morning...

Thanks TIM
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: grread + ortho
« Reply #18 on: February 12, 2009, 03:06:27 PM »
Thanks Tim,

I got it working as hoped.  Still scratching my head at the code though (maybe some commenting  :wink: )

I am in the process of dissecting it now

Thanks again
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

T.Willey

  • Needs a day job
  • Posts: 5251
Re: grread + ortho
« Reply #19 on: February 12, 2009, 05:26:43 PM »
Thanks Tim,

I got it working as hoped.  Still scratching my head at the code though (maybe some commenting  :wink: )

I am in the process of dissecting it now

Thanks again

Sounds good.  You're welcome Tim.  Here is the code commented a bit to help you understand it.  Let me know if there is still a section you don't understand.

Code: [Select]
(defun GetPointAtAngle ( pt baseAng / tempList pt2 flag ang pt3 tempAng )
   
    (setq flag T)
    (while
        (and
            flag
            (not (member (car (setq tempList (grread T 0))) '(11 25)))
        )
        ; above just lets you move the mouse until an enter is hit, by right click or not
        (redraw)
        ; just to get the old graphic line off the screen
        (if (member (car tempList) '(3 5))
        ; if the mouse is moved, or left clicked do what is below
            (progn
                (setq pt2 (cadr tempList))
                ; get the point of the mouse
                (setq ang (angle pt pt2))
                ; get the angle between the supplied point, and where the mouse is
                (setq tempAng
                    (caar
                        (vl-sort
                            (mapcar
                                '(lambda (x)
                                    (cons x (abs (- x ang)))
                                )
                                ; make a list of lists, ( the 90 degree angle list . the amount of difference between that angle, and the on one between the supplied point, and the mouse )
                                ; this will be used to see what angle the mouse is closest to, so that we can show the correct angle being snaped to.
                                (list
                                    baseAng
                                    (rem (+ baseAng (* pi 0.5)) (* pi 2.))
                                    (rem (+ baseAng pi) (* pi 2.))
                                    (rem (+ baseAng (* pi 1.5)) (* pi 2.))
                                )
                                ; make a list of all the angles off the supplied angle, 90 degree list
                            )
                            '(lambda (a b)
                                (< (cdr a) (cdr b))
                            )
                            ; sort the list by the smallest angle
                        )
                    )
                )
                ; set the correct 90 degree angle
                (setq pt3
                    (polar
                        pt
                        tempAng
                        (*
                            (cos
                                (if (> tempAng ang)
                                    (- tempAng ang)
                                    (- ang tempAng)
                                )
                                ; to find the correct angle for the trig function, we have to find the angle that is the difference of the angle of points, and the angle of 90 degrees
                                ; since we need it to be positive, and in the right direction, we have to subtract the smaller angle from the larger one.
                            )
                            (distance pt pt2)
                            ; this is the hypothnus
                        )
                        ; getting the correct distance takes a trig function.  since we know the angle and the hypothnus, then we can figure out the adjacent distance.
                    )
                )
                (grdraw pt pt3 1)
                (if (equal (car tempList) 3)
                    (setq flag nil)
                    (setq pt3 nil)
                )
                ; if the point is picked, and not just draged about, then set flag to nil to end the while
            )
        )
    )
    (redraw)
    pt3
)
Tim

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

Please think about donating if this post helped you.

Maverick®

  • Seagull
  • Posts: 14778
Re: grread + ortho
« Reply #20 on: February 12, 2009, 05:35:57 PM »
Wait.  Which one is TIM and which is Tim?  :-D

FengK

  • Guest
Re: grread + ortho
« Reply #21 on: March 08, 2009, 03:54:03 AM »
Code: [Select]
            (not (member (car (setq tempList (grread T 0))) '(11 25)))

Tim, according to the autolisp reference, seems the the 1st element of grread function's return values is 2, through 12. How did you get the 25? Thanks.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: grread + ortho
« Reply #22 on: March 08, 2009, 06:48:42 AM »
Hi xycadd,

Try enter (grread) at command line, then right click. It returns 11 or 25 according to SHORTCUTMENU sysvar value.
Speaking English as a French Frog

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: grread + ortho
« Reply #23 on: March 09, 2009, 07:20:06 AM »
OK here is the semi-final results of your help.  This is what I was shooting for.  This has been approved for use at my company.

A bit more tweaking and it'l be totally ready to go.

Thanks again TIM
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: grread + ortho
« Reply #24 on: March 09, 2009, 08:46:50 AM »
Hi,

You can see here a way to use (and toogle) orthomode inside a grread loop.
Speaking English as a French Frog

T.Willey

  • Needs a day job
  • Posts: 5251
Re: grread + ortho
« Reply #25 on: March 09, 2009, 11:14:18 AM »
OK here is the semi-final results of your help.  This is what I was shooting for.  This has been approved for use at my company.

A bit more tweaking and it'l be totally ready to go.

Thanks again TIM

You're welcome Tim.  Glad you got it going.

Code: [Select]
            (not (member (car (setq tempList (grread T 0))) '(11 25)))

Tim, according to the autolisp reference, seems the the 1st element of grread function's return values is 2, through 12. How did you get the 25? Thanks.

Hi xycadd,

Try enter (grread) at command line, then right click. It returns 11 or 25 according to SHORTCUTMENU sysvar value.

Exactly.  Thanks gile.  Found that out when I was developing the polyline arrow routine I did.  Alan and I had ours setup differently, so it wasn't working correctly for him, and that was the reason why, so I keep that store in my memory back.
Tim

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

Please think about donating if this post helped you.

FengK

  • Guest
Re: grread + ortho
« Reply #26 on: March 10, 2009, 04:52:35 AM »
Hi xycadd,

Try enter (grread) at command line, then right click. It returns 11 or 25 according to SHORTCUTMENU sysvar value.

Thanks gile!