Author Topic: how to use handle??  (Read 4964 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...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: how to use handle??
« Reply #15 on: July 09, 2007, 11:34:24 PM »
... and has it changed ?
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 #16 on: July 09, 2007, 11:47:45 PM »
yap! i change... but i have to compute its points to get the exact arc... and how...???

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: how to use handle??
« Reply #17 on: July 09, 2007, 11:49:10 PM »
Why not draw new Arc?
;;  StPt  is the start point, remember counter clockwise
;;  EndPt is the End Point
;;  radius is the desired radius
(command "_.Arc" "_non" StPt "_EN" "_non" EndPt "_R" radius)
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.

rainier

  • Guest
Re: how to use handle??
« Reply #18 on: July 10, 2007, 02:25:59 AM »
thanks CAB,

(command "_.Arc" "_non" StPt "_EN" "_non" EndPt "_R" radius)

what is "_non" in the command ?
« Last Edit: July 10, 2007, 02:29:19 AM by rainier »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: how to use handle??
« Reply #19 on: July 10, 2007, 09:48:09 AM »
From the help file:
See the last item.

Quote
OSNAP

Sets object snap modes

An object snap mode specifies a snap point at an exact location on an object. You can use an object snap once in the middle of a command, or you can set running object snaps. Running object snap modes can be toggled on and off with the Osnap button on the status bar. You can use the TAB key to cycle through available object snaps. Object snap settings are stored with the drawing.

Object Snap toolbar:
   Tools Menu: Drafting Settings
   Shortcut menu: Press SHIFT while right-clicking in the drawing area and choose Osnap Settings.
   Command line: osnap (or 'osnap for transparent use)

AutoCAD displays the Object Snaps tab in the Drafting Settings dialog box.
If you enter -osnap at the Command prompt, OSNAP presents options on the command line.

Current osnap modes: current

Enter list of object snap modes:  Enter names of object snap modes, or enter none or off

Specify one or more object snap modes by entering the first three characters of the name. If you enter more than one name, separate the names with commas.

ENDpoint
Snaps to the closest endpoint of an arc, elliptical arc, line, mline, polyline segment, or ray or to the closest corner of a trace, solid, or 3D face.

MIDpoint
Snaps to the midpoint of an arc, ellipse, elliptical arc, line, mline, polyline segment, solid, spline, or xline.

INTersection
Snaps to the intersection of an arc, circle, ellipse, elliptical arc, line, mline, polyline, ray, spline, or xline.
NOTE You may get varying results if you have both Intersection and Apparent Intersection on at the same time.

EXTension
Snaps to the extension point of an object. You can establish an extension path by moving the cursor over the endpoint of an object. A marker is placed on the endpoint. While the endpoint is marked, the cursor snaps to the extension path of the endpoint.

APParent Intersection
Apparent Intersection includes two separate snap modes: Apparent Intersection and Extended Apparent Intersection. You can also locate Intersection and Extended Intersection snap points while running Apparent Intersection object snap mode.
Apparent Intersection snaps to the apparent intersection of two objects (arc, circle, ellipse, elliptical arc, line, mline, polyline, ray, spline, or xline) that do not intersect in 3D space but appear to intersect in the drawing display. Extended Apparent Intersection snaps to the imaginary intersection of two objects that would appear to intersect if the objects were extended along their natural paths.

NOTE You may get varying results if you have both Intersection and Apparent Intersection on at the same time. Apparent and Extended Apparent Intersection recognize edges of regions and curves but not edges or corners of 3D solids.

CENter
Snaps to the center of an arc, circle, ellipse, or elliptical arc.

NODe
Snaps to a point object.

QUAdrant
Snaps to a quadrant point of an arc, circle, ellipse, or elliptical arc.

INSertion
Snaps to the insertion point of an attribute, a block, a shape, or text.

PERpendicular
Snaps to a point perpendicular to an arc, circle, ellipse, elliptical arc, line, mline, polyline, ray, solid, spline, or xline.

TANgent
Snaps to the tangent of an arc, circle, ellipse, or elliptical arc.

NEArest
Snaps to the nearest point on an arc, circle, ellipse, elliptical arc, line, mline, point, polyline, spline, or xline.

PARallel
Snaps to an extension in parallel with an object. When you move the cursor over the endpoint of an object, the endpoint is marked and the cursor snaps to the parallel alignment path to that object. The alignment path is calculated from the current "from point" of the command.

QUIck
Snaps to the first snap point found. Quick must be used in conjunction with other object snap modes.

NONe
Turns off object snap modes
.
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.

rainier

  • Guest
Re: how to use handle??
« Reply #20 on: July 10, 2007, 08:55:28 PM »
thank you for a long archive that you gave to me... thanks ... i have a lot to learn...

thank you very much CAB....  8-) :-)


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: how to use handle??
« Reply #21 on: July 10, 2007, 10:04:08 PM »
You're quite welcome.
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.