p7q Posted April 10 Posted April 10 Hi everyone, I noticed something confusing while inspecting an ARC entity in AutoCAD using AutoLISP. When I use entget to examine the arc, DXF code 10 returns a specific point — but it doesn't match the Start X/Y/Z values shown in the Properties panel. For example: Why are these different? I thought DXF code 10 might represent the start point, but it looks like it's actually something else. Could someone explain what this value actually represents, and why it's different from the Start Point shown in the Properties palette? Thanks in advance! Quote
Emmanuel Delay Posted April 10 Posted April 10 (edited) An Arc has - a Center point: code 10 - a radius: code 40 (which is usually a scale code) - a start angle: code 50 - a end angle: code 51 Which is the most logical way of coding an arc, I would say. The same codes apply for the circle, if the circle were to be full. Except of course that circle doesn't have a start and endpoint --- For a block INSERT code 10 is the insertpoint, ... but yes, often code 10 in the start point, as you say Edited April 10 by Emmanuel Delay 1 Quote
p7q Posted April 10 Author Posted April 10 Thank you for the explanation @Emmanuel Delay. But I had already mentioned that I know code 10 represents the center point. What I'm actually wondering is why I can't access the Start Point shown in the Properties panel through entget. My goal is to set the Z value of the center, start, and end points of an ARC entity to 0. I can get the center point from DXF code 10, but I can’t access or modify the start and end points directly. Quote
Saxlle Posted April 10 Posted April 10 (edited) Hi @p7q, I suppose it's because every entity (LINE, CIRCLE, ARC, etc.) have they own DXF codes which are they describe them. Every additional code, means you need to use XDATA. As you can se from this reference (and it's looks like from your picture), there is DXF codes which describe the ARC entity, and it's matching from your picture, except of those which are default (-1 . <Entity name: 161e30719f0> (but the entity name is changeable everytime when you close and open again the same drawing), 5 . "14D7", etc.). So, if you want to get a start and end point of an ARC entity, you need to use: (setq ent (car (entsel "\nSelect ARC entity:"))) (setq obj (vlax-ename->vla-object ent)) (setq spt (vlax-curve-getStartPoint obj)) ;; you will get a start point (setq ept (vlax-curve-getEndPoint obj)) ;; you will get a end point ...... the rest of your code Additional, if you want a list of all Properties which are available to an ARC entity, use this (you will find start and end point here): (vlax-dump-object obj) You will get something like this: ; IAcadArc: AutoCAD Arc Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff68ef28c20> ; ArcLength (RO) = 1226.33 ; Area (RO) = 228305.0 ; Center = (2719.92 1628.09 60.0) ; Document (RO) = #<VLA-OBJECT IAcadDocument 000001fefd8339c8> ; EndAngle = 5.40167 ; EndPoint (RO) = (2922.48 1382.31 60.0) ; EntityTransparency = "ByLayer" ; Handle (RO) = "2D5" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000001febfd46888> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 42 ; ObjectName (RO) = "AcDbArc" ; OwnerID (RO) = 43 ; PlotStyleName = "ByLayer" ; Radius = 318.498 ; StartAngle = 1.55132 ; StartPoint (RO) = (2726.12 1946.53 60.0) ; Thickness = 0.0 ; TotalAngle (RO) = 3.85034 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 000001febfd45b00> ; Visible = -1 T I think that is the reason why you can't get a start/end point from using (entget (car (etnsel))). Best regards. Edited April 10 by Saxlle Quote
CyberAngel Posted April 10 Posted April 10 I seem to remember that you can't change the elevation of the start/end points, which is why they're greyed out in the properties. You can change the center point's elevation, which makes things easier. 1 Quote
Emmanuel Delay Posted April 10 Posted April 10 On 4/10/2025 at 12:27 PM, CyberAngel said: I seem to remember that you can't change the elevation of the start/end points, which is why they're greyed out in the properties. You can change the center point's elevation, which makes things easier. Expand Right. Autocad is still a technical drawing program, mimicing pen and paper. The user can tilt the paper (UCS), and then draws on that plane. So a circle or an arc means that you set the needle on thet plane, then you draw on that plane. You can't elevate the start or endpoint. You can elevate the whole arc, you can tilt the plane on which the arc is drawn... If you could elevate just 1 start or endpoint then it's no longer an arc. That's the general idea, it's not absolutely true, since there are things like 3D polylines 1 Quote
Saxlle Posted April 10 Posted April 10 That is also true. From above post, there is: "; EndPoint (RO) = (2922.48 1382.31 60.0)" and "; StartPoint (RO) = (2726.12 1946.53 60.0)" which mean that those values are Read-Only. Just for the comparing with an ARC entity, if we look at LINE entity, we can see: ; IAcadLine: AutoCAD Line Interface ; Property values: ; Angle (RO) = 0.537846 ; Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff68ef28c20> ; Delta (RO) = (4327.92 2581.63 0.0) ; Document (RO) = #<VLA-OBJECT IAcadDocument 000001ff4ebccac8> ; EndPoint = (10848.9 6169.43 0.0) ; EntityTransparency = "ByLayer" ; Handle (RO) = "2BB" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000001ff408f17a8> ; Layer = "0" ; Length (RO) = 5039.42 ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 45 ; ObjectName (RO) = "AcDbLine" ; OwnerID (RO) = 42 ; PlotStyleName = "ByLayer" ; StartPoint = (6521.01 3587.8 0.0) ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 000001ff408f0540> ; Visible = -1 and for "; EndPoint = (10848.9 6169.43 0.0)" and "; StartPoint = (6521.01 3587.8 0.0)" there is no (RO)=Read-Only. So, that mean they can be changed. Using (entget (car (entsel "\nSelect a LINE:"))), you can get those values (start/end point), and it looks like this: ((-1 . <Entity name: 1fed0ce6cb0>) (0 . "LINE") (330 . <Entity name: 1fed0b299f0>) (5 . "2BB") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 6521.01 3587.8 0.0) (11 10848.9 6169.43 0.0) (210 0.0 0.0 1.0)) Hope @p7q you will find something good in this. Quote
p7q Posted April 10 Author Posted April 10 Thanks again for the helpful replies! Just to clarify what I’m seeing — because I think the key point might be a bit different than just the Z elevation. If an ARC looks like a curve in Top view and also looks like a curve in Front view, then that arc must be in a 3D plane, not flat on the XY plane. Now here’s the interesting part: When I use FLATTEN, the same arc still looks like a proper arc in Top view — but in Front view, it now appears as just a straight line. So visually, it's become completely 2D — even though it's still technically an ARC entity. That means FLATTEN is not just setting the center Z to 0 — it's also resetting the arc's plane (Normal vector) so that it's perfectly flat on the XY plane. I had tried doing this manually in code, by setting the center Z to 0 and the normal to (0 0 1), like this: (if (member entType '("ARC" "CIRCLE" "ELLIPSE")) (progn (setq objj (vlax-ename->vla-object obj)) (vla-put-Center objj (vlax-3d-point (list (car (vlax-get objj 'Center)) (cadr (vlax-get objj 'Center)) 0.0 ) ) ) (vlax-put objj 'Normal (list 0.0 0.0 1.0)) ) ) But this sometimes gives me a “General modeling failure” error. So clearly, FLATTEN is doing something internally that’s more robust than just setting the center and normal. That’s what I’m trying to figure out — how exactly does FLATTEN make a 3D arc truly 2D without errors, and why doesn’t the same thing always work when done through code? Quote
p7q Posted April 10 Author Posted April 10 On 4/10/2025 at 1:00 PM, Saxlle said: That is also true. From above post, there is: "; EndPoint (RO) = (2922.48 1382.31 60.0)" and "; StartPoint (RO) = (2726.12 1946.53 60.0)" which mean that those values are Read-Only. Just for the comparing with an ARC entity, if we look at LINE entity, we can see: ; IAcadLine: AutoCAD Line Interface ; Property values: ; Angle (RO) = 0.537846 ; Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff68ef28c20> ; Delta (RO) = (4327.92 2581.63 0.0) ; Document (RO) = #<VLA-OBJECT IAcadDocument 000001ff4ebccac8> ; EndPoint = (10848.9 6169.43 0.0) ; EntityTransparency = "ByLayer" ; Handle (RO) = "2BB" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000001ff408f17a8> ; Layer = "0" ; Length (RO) = 5039.42 ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 45 ; ObjectName (RO) = "AcDbLine" ; OwnerID (RO) = 42 ; PlotStyleName = "ByLayer" ; StartPoint = (6521.01 3587.8 0.0) ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 000001ff408f0540> ; Visible = -1 and for "; EndPoint = (10848.9 6169.43 0.0)" and "; StartPoint = (6521.01 3587.8 0.0)" there is no (RO)=Read-Only. So, that mean they can be changed. Using (entget (car (entsel "\nSelect a LINE:"))), you can get those values (start/end point), and it looks like this: ((-1 . <Entity name: 1fed0ce6cb0>) (0 . "LINE") (330 . <Entity name: 1fed0b299f0>) (5 . "2BB") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 6521.01 3587.8 0.0) (11 10848.9 6169.43 0.0) (210 0.0 0.0 1.0)) Hope @p7q you will find something good in this. Expand I realized that I can't change the start and end points. Thank you. Is there another method other than VLA-OBJECT? Quote
Saxlle Posted April 10 Posted April 10 Maybe you can create insted of Arc a Polyline Arc, like from this Lee Mac Bulge Conversion Functions. It will look like this: Try with that and see if it helpful. 1 Quote
p7q Posted April 11 Author Posted April 11 On 4/10/2025 at 1:30 PM, Saxlle said: Maybe you can create insted of Arc a Polyline Arc, like from this Lee Mac Bulge Conversion Functions. It will look like this: Try with that and see if it helpful. Expand I don't need to create an arc, I need to change the data of the existing arc. But thank you for your interest anyway. Quote
CyberAngel Posted April 11 Posted April 11 On 4/10/2025 at 1:09 PM, p7q said: Thanks again for the helpful replies! Just to clarify what I’m seeing — because I think the key point might be a bit different than just the Z elevation. If an ARC looks like a curve in Top view and also looks like a curve in Front view, then that arc must be in a 3D plane, not flat on the XY plane. Now here’s the interesting part: When I use FLATTEN, the same arc still looks like a proper arc in Top view — but in Front view, it now appears as just a straight line. So visually, it's become completely 2D — even though it's still technically an ARC entity. That means FLATTEN is not just setting the center Z to 0 — it's also resetting the arc's plane (Normal vector) so that it's perfectly flat on the XY plane. (if (member entType '("ARC" "CIRCLE" "ELLIPSE")) (progn (setq objj (vlax-ename->vla-object obj)) (vla-put-Center objj (vlax-3d-point (list (car (vlax-get objj 'Center)) (cadr (vlax-get objj 'Center)) 0.0 ) ) ) (vlax-put objj 'Normal (list 0.0 0.0 1.0)) ) ) ... So clearly, FLATTEN is doing something internally that’s more robust than just setting the center and normal. That’s what I’m trying to figure out — how exactly does FLATTEN make a 3D arc truly 2D without errors, and why doesn’t the same thing always work when done through code? Expand My guess is that the original arc was not drawn in the World UCS. That's why you get a 210 code, to define the object's original plane. Another guess, FLATTEN translates the center point to the XY plane and then redefines the arc as if you'd drawn it in World UCS. That's why it doesn't look like what you expect. The new start/end points have no relation to the originals. 1 Quote
Isaac26a Posted April 17 Posted April 17 I'm not sure if I got pretty late to the party but hope this helps ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;; Program masp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Program to Modify an Arc's Start Point ;;; ;;; 20250416 V1.0 Created ;;; ;;; ;;; ;;; ;;; ;;; By Isaac A. ;;; ;;; ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (vl-load-com) (defun c:masp (/ a b c d dw) ; (vl-cmdf "_.undo" "_begin") (vla-startundomark (setq dw (vla-get-activedocument (vlax-get-acad-object)))) (setvar 'cmdecho 0) (setq a (car (entsel "\nSelect the arc to modify: \n")) b (cdr (assoc 10 (entget a))) ) (setq c (getpoint "\nSelect the new start point: ") d (angle b c) ) (entmod (subst (cons 50 d) (assoc 50 (entget a)) (entget a))) (setq c (getpoint "\nSelect the new end point: ") d (angle b c) ) (entmod (subst (cons 51 d) (assoc 51 (entget a)) (entget a))) ; (vl-cmdf "_.undo" "_end") (vla-endundomark dw) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; End of file ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; If for any reason you don't want to use any vla commands you can replace the vla with the ones with the semicolon (vl-cmdf ...) Quote
Recommended Posts
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.