Author Topic: Examples of usage GRREAD - let's share  (Read 197365 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: Examples of usage GRREAD - let's share
« Reply #30 on: December 18, 2009, 08:24:55 PM »

a description of what it's 'sposed to do would be handy.
... and that first prompt confuses me "\nPick Center of First Radius: "

Regards
Kerry

Apologies Kerry, post updated.  :oops:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Examples of usage GRREAD - let's share
« Reply #31 on: December 18, 2009, 08:27:22 PM »

a description of what it's 'sposed to do would be handy.
... and that first prompt confuses me "\nPick Center of First Radius: "

Regards
Kerry

Apologies Kerry, post updated.  :oops:

No apologies needed :)
... just thinking of those following who may not be able to grasp intent from the code.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

xianaihua

  • Guest
Re: Examples of usage GRREAD - let's share
« Reply #32 on: December 18, 2009, 08:56:17 PM »
Hi Lee Mac

nice work! :-D

I have a suggestion: You can enter a numeric value of the radius increased!

Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: Examples of usage GRREAD - let's share
« Reply #33 on: December 18, 2009, 09:28:48 PM »
Hi Lee Mac

nice work! :-D

I have a suggestion: You can enter a numeric value of the radius increased!

Thanks Xianaihua :-)

Yes, that seems to be the next logical improvement  8-)

Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: Examples of usage GRREAD - let's share
« Reply #34 on: December 19, 2009, 01:17:38 PM »
Code updated to accept keyboard input.  :wink:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Examples of usage GRREAD - let's share
« Reply #35 on: December 19, 2009, 07:08:17 PM »

a description of what it's 'sposed to do would be handy.
... and that first prompt confuses me "\nPick Center of First Radius: "

Regards
Kerry

Apologies Kerry, post updated.  :oops:

No apologies needed :)
... just thinking of those following who may not be able to grasp intent from the code.

ahh yes ! a picture is worth a thousand words. !
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

xianaihua

  • Guest
Re: Examples of usage GRREAD - let's share
« Reply #36 on: December 22, 2009, 05:49:35 AM »
Code: [Select]
;;;by:lihuili 2009-12-20
;;;Dynamic drawing a line to another line perpendicular bisector
(defun Perp_bisector_line (/   ent en      pt     enname
   p1   p2 ang ptemp1 p0     pt1
   sp   source ptemp ptemp1 ptemp2 ptemp3
   pt1   pt2 pt3 loop
  )
  (setvar "cmdecho" 0)
  (if (and (setq ent (car (entsel "\n select a line.")))
   (= (cdr (assoc 0 (setq en (entget ent)))) "LINE")
      )
    (progn
      (redraw ent 3)

      (setq p1 (trans (cdr (assoc 10 en)) 0 1)
    p2 (trans (cdr (assoc 11 en)) 0 1)
    ang (angle p1 p2)
      )
      (setq p0     (polar p1 ang (* 0.5 (distance p1 p2)))
    lineobj (vla-addLine
      (vla-get-ModelSpace
(vla-get-ActiveDocument (vlax-get-acad-object))
      )
      (vlax-3d-point p0)
      (vlax-3d-point p0)
    )
      )


      (setq ptemp1 (polar p0 (+ ang (* 0.5 pi)) 10))
      (prompt "\n to:")
      (setq loop t
    ptemp p0
    pt1 p0
      )
      (while loop
(setq sp (grread t))
(setq source (car sp)
      sp     (cadr sp)
)
(cond ((= source 5)
       (setq ptemp sp)
       (setq ptemp2 (polar sp 0 10)
     ptemp3 (polar sp (* 0.5 pi) 10)
       )
       (setq pt2 (inters p0 ptemp1 sp ptemp2 nil))
       (setq pt3 (inters p0 ptemp1 sp ptemp3 nil))
       (cond ((null pt2) (setq pt1 pt3))
     ((null pt3) (setq pt1 pt2))
     (t
      (if (< (distance sp pt2) (distance sp pt3))
(setq pt1 pt2)
(setq pt1 pt3)
      )
     )
       )
       (vla-put-EndPoint lineobj (vlax-3d-point pt1))
      )
      (t (setq loop nil))
)
      )
     
      (redraw ent 4)
    )

    (prompt "\n No select a line!")
  )
  (princ)
)


(defun c:test ()
  (Perp_bisector_line)
)

Fred Tomke

  • Newt
  • Posts: 38
  • [ Mr. Bad Guy ]
Re: Examples of usage GRREAD - let's share
« Reply #37 on: December 22, 2009, 06:18:49 AM »
Hi, I neither want to disturb nor to annoy but I'd prefer to rotate the crosshair while dragging perpendicular (see attached gif).

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

alanjt

  • Needs a day job
  • Posts: 5351
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #38 on: December 22, 2009, 10:05:57 AM »
Hey xianaihua, I did something similar to that...

Code: [Select]
;;; Draw perpendicular line
;;; Alan J. Thompson, 10.15.09
(defun c:LPer (/ #Ent #Read)
  (and
    (setq #Ent (car (entsel "\nSelect curve: ")))
    (vl-position (cdr (assoc 0 (entget #Ent))) '("LWPOLYLINE" "ARC" "LINE" "CIRCLE" "ELLIPSE"))
    (while (not (eq 25 (car (setq #Read (grread T 15 0)))))
      (princ "\rSpecify point for line: ")
      (redraw)
      (if (vl-consp (cadr #Read))
        (grdraw (vlax-curve-getclosestpointto #Ent (trans (cadr #Read) 1 0) T)
                (trans (cadr #Read) 1 0)
                1
        ) ;_ grdraw
      ) ;_ if
      (if (eq 3 (car #Read))
        (entmake (list '(0 . "LINE")
                       (cons 10 (vlax-curve-getclosestpointto #Ent (trans (cadr #Read) 1 0) T))
                       (cons 11 (trans (cadr #Read) 1 0))
                 ) ;_ list
        ) ;_ entmake
      ) ;_ if
    ) ;_ while
  ) ;_ and
  (redraw)
  (princ)
) ;_ defun
« Last Edit: December 22, 2009, 10:09:54 AM by alanjt »
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

xianaihua

  • Guest
Re: Examples of usage GRREAD - let's share
« Reply #39 on: December 22, 2009, 11:14:48 AM »
Hi,alanjt
nice work!
Your program can add to the block processing,In other words, be able to select block.

alanjt

  • Needs a day job
  • Posts: 5351
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #40 on: December 22, 2009, 12:30:45 PM »
Hi,alanjt
nice work!
Your program can add to the block processing,In other words, be able to select block.
:) Thanks
No, the vlax-curve... functions don't work on blocks.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

rkmcswain

  • Swamp Rat
  • Posts: 978
Re: Examples of usage GRREAD - let's share
« Reply #41 on: December 22, 2009, 01:24:23 PM »
Don't flame me too bad... I know, no code, but here is a animation of what it does....

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Examples of usage GRREAD - let's share
« Reply #42 on: December 22, 2009, 01:33:08 PM »
Ooooh....   :kewl:
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

alanjt

  • Needs a day job
  • Posts: 5351
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #43 on: December 22, 2009, 01:42:58 PM »
I posted this one in another thread....
http://www.theswamp.org/index.php?topic=30660.0
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5351
  • Standby for witty remark...
Re: Examples of usage GRREAD - let's share
« Reply #44 on: December 22, 2009, 01:43:59 PM »
Don't flame me too bad... I know, no code, but here is a animation of what it does....

Very cool!
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox