Author Topic: how to use handle??  (Read 4973 times)

0 Members and 1 Guest are viewing this topic.

rainier

  • Guest
how to use handle??
« on: July 09, 2007, 03:35:12 AM »
hi guys, help me with my routine...

how to use handle??
sample:
(Command: (command "fillet" "r" "0" (handent "2D7A21") (handent "2D7A1F"))
<Entity name: 400E9448>

Unknown command "sample".  Press F1 for help.
<Entity name: 400E9438>

Unknown command "sample".  Press F1 for help.
nil  ;<--- nil prompt


how to use it,,,

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: how to use handle??
« Reply #1 on: July 09, 2007, 03:56:08 AM »
difficult without seeing your code.

Why are you using handles to identify entitys to fillet ?

What is the 'Sample' command you are trying to run ?
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.

Adesu

  • Guest
Re: how to use handle??
« Reply #2 on: July 09, 2007, 04:26:11 AM »
you should like this
Code: [Select]
(defun c:test (/ el1 el2 pt1 pt2 pt3 pt4)
  (setq pt1 '(0 0 0))
  (setq pt2 '(10 0 0))
  (command "_line" pt1 pt2 "")
  (setq el1 (entlast))
  (setq en1 (entget el1))
  (setq ent1 (cdr (assoc 5 en1)))
  (setq ename1 (handent ent1)) 
  (setq pt3 '(10 0 0))
  (setq pt4 '(10 5 0))
  (command "_line" pt3 pt4 "")
  (setq el2 (entlast))
  (setq en2 (entget el2))
  (setq ent2 (cdr (assoc 5 en2)))
  (setq ename2 (handent ent2))
  (command "_fillet" "r" 3 "_fillet" ename1 ename2) 
  (princ)
  ) ; defun

hi guys, help me with my routine...

how to use handle??
sample:
(Command: (command "fillet" "r" "0" (handent "2D7A21") (handent "2D7A1F"))
<Entity name: 400E9448>

Unknown command "sample".  Press F1 for help.
<Entity name: 400E9438>

Unknown command "sample".  Press F1 for help.
nil  ;<--- nil prompt


how to use it,,,


rainier

  • Guest
Re: how to use handle??
« Reply #3 on: July 09, 2007, 05:32:54 AM »
thank you very much ADE, for me your a great Lisp programmer... wOw  :kewl: bravo

rainier

  • Guest
Re: how to use handle??
« Reply #4 on: July 09, 2007, 05:39:23 AM »
other thing...

how to change start point and end point of an Arc?
(if en (entsel "\n select arc:")
  (progn
    (setq enlist (entget en))
    (setq vlaxobj (vlax-ename->vla-object en))
    (setq vlaxstartpt (vlax-get vlaxobj "StartPoint"))
    (setq vlaxendpt (vlax-get vlaxobj "EndPoint"))

    ; how to change the coordinated.... is there a way to change it..
    ; and entupd it or other update in vlax...?
  )
)
(princ)
)

please help...

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: how to use handle??
« Reply #5 on: July 09, 2007, 08:14:16 AM »
There is no start or end point property.
Perhaps this will help you out. I don't remember the source for this code.

Code: [Select]
;;;The entity definition data of an arc doesn't reveal much direct information about that arc.
;;;All you get are: center point, start angle, end angle and radius.
;;;However, with a bit of math, you can get much more. Here's how:

;;; Returns a list containing both arc endpoints, arc length and chord length
(defun arc-info   (ent / lst cen rad ang1 ang2 p1 p2 len chord)
  (setq   lst   (entget ent)
          cen   (cdr (assoc 10 lst))        ; center point
          rad   (cdr (assoc 40 lst))        ; radius
          ang1  (cdr (assoc 50 lst))        ; start angle
          ang2  (cdr (assoc 51 lst))        ; end angle
          inc   (- ang1 ang2)               ; included angle
          inc   (if (minusp inc) (- inc) (- (* pi 2.0) inc)) ; included angle correction
          p1    (polar cen ang1 rad)        ; start point
          p2    (polar cen ang2 rad)        ; end point
          len   (* (/ inc (* 2 pi))        ; arc length: (included angle / 360) * circumference
                  (* 2 (* pi rad))
                )
            ;;  another arc length (abs (* (- ang1 ang2) ra))
          chord (distance p1 p2)           ; chord length
  )
  (list p1 p2 len chord)
)
;;;Arguments
;;;The entity name of an arc
;;;
;;;Example
;;;(arc-info (car (entsel)))
;;;
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.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: how to use handle??
« Reply #6 on: July 09, 2007, 11:13:09 AM »
CAB,

These properties exist in 2008:

Select Entity to Display it's Data: ; IAcadArc: AutoCAD Arc Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00d73d3c>
;   ArcLength (RO) = 5.70731
;   Area (RO) = 4.85198
;   Center = (6.80792 2.02792 0.0)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 01b75558>
;   EndAngle = 2.9975
;   EndPoint (RO) = (4.42674 2.37342 0.0)
;   Handle (RO) = "123"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 065f72ec>
;   Layer = "0"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 2130392472
;   ObjectName (RO) = "AcDbArc"
;   OwnerID (RO) = 2130386200
;   PlotStyleName = "ByLayer"
;   Radius = 2.40611
;   StartAngle = 0.6255
;   StartPoint (RO) = (8.75848 3.43671 0.0)
;   Thickness = 0.0
;   TotalAngle (RO) = 2.37201
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 06589ed8>
;   Visible = -1

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: how to use handle??
« Reply #7 on: July 09, 2007, 11:41:59 AM »
Thanks Ron,
I see that they are Read Only, so they are calculated for you. Therefore you can't change the Arc using them. You will need to calculate the new start & end angles and update those properties. Right?
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.

ronjonp

  • Needs a day job
  • Posts: 7531
Re: how to use handle??
« Reply #8 on: July 09, 2007, 11:52:14 AM »
That is correct :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

rainier

  • Guest
Re: how to use handle??
« Reply #9 on: July 09, 2007, 06:21:11 PM »
thanks guys,

i need a lisp routine code for changing the arc's coordinated or lisp formula to change the assoc like:
  cen    (cdr (assoc 10 lst))        ; center point
  rad    (cdr (assoc 40 lst))        ; radius
  ang1  (cdr (assoc 50 lst))        ; start angle
  ang2  (cdr (assoc 51 lst))        ; end angle

maybe the radius value will still remain at ease, but the center point, start or end angles will be change...
any idea to change it mathematically??  here is my sample.. attach.

please help... thanks
« Last Edit: July 09, 2007, 06:22:34 PM by rainier »

ronjonp

  • Needs a day job
  • Posts: 7531
Re: how to use handle??
« Reply #10 on: July 09, 2007, 06:30:53 PM »
Could you not just use fillet?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

rainier

  • Guest
Re: how to use handle??
« Reply #11 on: July 09, 2007, 07:01:00 PM »
the sequence i draw was line to arc to line, what if i have a line to arc to arc or arc to arc to arc... in that sequence i cant make a fillet on it...

is there other mathematical computation... to change the coordinates....  :-(

please help.. thanks..

rainier

  • Guest
Re: how to use handle??
« Reply #12 on: July 09, 2007, 10:16:04 PM »
guys, help me...

maybe there is a solution on the changing the coordinated... mathematically or logically...
or maybe Lisp routine can solve this problem...

how about stretch command... 

how to use stretch with out using window select but its points... to change its coordinates...??

please help... 
« Last Edit: July 09, 2007, 10:21:42 PM by rainier »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: how to use handle??
« Reply #13 on: July 09, 2007, 11:10:05 PM »

Have you tried simply changing the arc centerPoint and radius ?


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.

rainier

  • Guest
Re: how to use handle??
« Reply #14 on: July 09, 2007, 11:18:17 PM »
yap! using entupd...