Jump to content

Recommended Posts

Posted
(setq ent (ssget))
     (setq arc (entlast))    ;object entith
     (setq Object (vlax-Ename->Vla-Object arc))

How can I find out the radius of the arc

Posted

Simple:

(vla-get-radius object)

another

(vlax-get object 'Radius)

 

 

and Try to Dump on Object You Can Find Arc Radius Here

 

Command: (vlax-dump-object object)
; IAcadArc: AutoCAD Arc Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00d73d3c>
;  ArcLength (RO) = 855.845
;   Area (RO) = 99636.1
;   Center = (214569.0 3.13291e+006 0.0)
;   Document (RO) = #<VLA-OBJECT IAcadDocument 01b8ed40>
;   EndAngle = 3.01769
;   EndPoint (RO) = (214143.0 3.13296e+006 0.0)
;   Handle (RO) = "889B24"
;   HasExtensionDictionary (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 1869af04>
;   Layer = "Csl"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Normal = (0.0 0.0 1.0)
;   ObjectID (RO) = 697240288
;   ObjectName (RO) = "AcDbArc"
;   OwnerID (RO) = 698100984
;   PlotStyleName = "Color_6"
;  [color="blue"] Radius = 429.555[/color]
;   StartAngle = 1.02529
;   StartPoint (RO) = (214792.0 3.13328e+006 0.0)
;   Thickness = 0.0
;   TotalAngle (RO) = 1.9924
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 1e98ea60>
;   Visible = -1

Posted

(setq ent ([b][color=blue]ssget[/color][/b]))       (setq arc (entlast))    ;object entith

Tthre is some thing wrong in my code.

I just want to pick on a arc and get the entity name.

but ssget is not doing this. what is the correct code to select the arc on cad drawing.

Posted

Try This Wimal

(setq ss (car (entsel "\nSelect Arc:")))
        (setq ename(vlax-ename->vla-object ss))
        (setq r (vla-get-radius ename))

 

or Single Selection with ssget

 

(setq ss (ssget ":S"))
         (setq ename(vlax-ename->vla-object (ssname ss 0)))
         (setq r (vla-get-radius ename))

Posted

Ssget function creates a lot of selection.

With entsel choose only one object.

Posted

Thanks every body. I got the answer

Posted

I need more help. With this code, If I select a line ; The program will stooped. Actually I want to select both lines and

arcs and if the object is a arc to get the radius of it

Posted
I need more help. With this code, If I select a line ; The program will stooped. Actually I want to select both lines and

arcs and if the object is a arc to get the radius of it

Have you thought about the possibility that the user could select more than one arc? Would the program then return all radii of the arcs? How would you then know which radius belonged to which arc?

Posted

Try This Code .

 

(defun c:Test ()
   (while
    (progn
	    (setvar 'errno 0)
        (setq ss (car (entsel "\nSelect Object:")))
			    (cond
				    ( ( = 7 (getvar 'errno)) (princ "\nNothing Selected."))
					( ( = (cdr (assoc 0 (entget ss))) "LINE") (princ "\nLine Was Picked."))
					( ( = (cdr (assoc 0 (entget ss))) "ARC")
					  (setq ent (vlax-ename->vla-object ss))
					  (setq r (vla-get-radius ent))
					  (princ r)
					)
				)
	)
)
(princ))

Posted
I need more help. With this code, If I select a line ; The program will stooped. Actually I want to select both lines and

arcs and if the object is a arc to get the radius of it

 

This piece of code would calculate the radius of the select arcs only , in regardless of lines' lengths .

 

(defun c:Test (/ ss in sn rd)
 (if (setq rd 0. ss (ssget '((0 . "LINE,ARC"))))
   (repeat (setq in (sslength ss))
     (setq sn (ssname ss (setq in (1- in))))
     (if (eq "ARC" (cdr (assoc 0 (entget sn))))
       (setq rd (+ rd (cdr (assoc 40 (entget sn)))))
     )
   )
 )
 (if (> rd 0.) (princ (strcat "\n Total Radius of Arcs : " (rtos rd 2 4))))
 (princ)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...