When is an Arc Object not an Arc Object? Well that's easy, when it used to be a Circle Object!!!
I recently built a function to clean up multiple intersections via a simple crossing window for selection. The function would repeat as long as you kept picking new window points.
The function seemed to work ok.
As I expanded my testing (and kept building in more options to cover more entity types and more complex intersections and started looking into optimizing the process a bit) I ran into some unexpected results...
A circle (as a vla-object), once trimmed, should now be an arc (as a vla-object). But it isn't... It does not "change type" to an ARC Object. The ObjectName property will report it as an arc, an entget call will report it as an arc, but the actual ActiveX object remains as a Circle Object, which means that it cannot report such things as "startpoint" and "endpoint" because circles don't have start and end points.
This is not simply a matter of the fact that I am performing the trim within Lisp... I tested via commands at the command line directly in ACAD. I performed the exact same procedures on ACAD 2009 on Windows Vista Business 32 bit, ACAD 2012 on Windows Vista Business 32 bit, ACAD 2014 on Windows 7 Professional 64 bit.
Testing this behavior is simple:
Draw a circle.
Draw a couple of intersecting lines.
Perform a Dump Object on the circle.
Trim the circle using the intersecting lines.
Perform a Dump Object on the resulting arc.
the following spoiler contains the results from all three test scenarios (as copied from the text screen).
***in Acad 2012 on Windows Vista Business 32 bit*** Command: (vl-load-com) Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) Select object: ; IAcadCircle2: AutoCAD Circle Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 01d5b450> ; Area = 23.3915 ; Center = (14.8167 10.3551 0.0) ; Circumference = 17.1449 ; Diameter = 5.45738 ; Document (RO) = #<VLA-OBJECT IAcadDocument 10601eb4> ; EntityTransparency = "ByLayer" ; Handle (RO) = "1AB" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 15311854> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 2129671576 ; ObjectName (RO) = "AcDbCircle" ; OwnerID (RO) = 2129665272 ; PlotStyleName = "ByLayer" ; Radius = 2.72869 ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 150cbd18> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T Command: TR TRIM Current settings: Projection=UCS, Edge=Extend Select cutting edges ... Select objects or <select all>: Specify opposite corner: 3 found Select objects: Select object to trim or shift-select to extend or [Fence/Crossing/Project/Edge/eRase/Undo]: Select object to trim or shift-select to extend or [Fence/Crossing/Project/Edge/eRase/Undo]: Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) Select object: ; IAcadCircle2: AutoCAD Circle Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 01d5b450> ; Area = AutoCAD.Application: Invalid class ; Center = AutoCAD.Application: Invalid class ; Circumference = AutoCAD.Application: Invalid class ; Diameter = AutoCAD.Application: Invalid class ; Document (RO) = #<VLA-OBJECT IAcadDocument 10601eb4> ; EntityTransparency = "ByLayer" ; Handle (RO) = "1AB" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 15313b54> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = AutoCAD.Application: Invalid class ; ObjectID (RO) = 2129671576 ; ObjectName (RO) = "AcDbArc" ; OwnerID (RO) = 2129665272 ; PlotStyleName = "ByLayer" ; Radius = AutoCAD.Application: Invalid class ; Thickness = AutoCAD.Application: Invalid class ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 150caed8> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T Command: BREAK Select object: Specify second break point or [First point]: f Specify first break point: int of Specify second break point: int of Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) Select object: ; IAcadCircle2: AutoCAD Circle Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 01d5b450> ; Area = AutoCAD.Application: Invalid class ; Center = AutoCAD.Application: Invalid class ; Circumference = AutoCAD.Application: Invalid class ; Diameter = AutoCAD.Application: Invalid class ; Document (RO) = #<VLA-OBJECT IAcadDocument 10601eb4> ; EntityTransparency = "ByLayer" ; Handle (RO) = "1AB" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 15311854> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = AutoCAD.Application: Invalid class ; ObjectID (RO) = 2129671576 ; ObjectName (RO) = "AcDbArc" ; OwnerID (RO) = 2129665272 ; PlotStyleName = "ByLayer" ; Radius = AutoCAD.Application: Invalid class ; Thickness = AutoCAD.Application: Invalid class ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 150caed8> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T Command: (entget (car (entsel))) Select object: ((-1 . <Entity name: 7ef03598>) (0 . "ARC") (330 . <Entity name: 7ef01cf8>) (5 . "1AB") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbCircle") (10 14.8167 10.3551 0.0) (40 . 2.72869) (210 0.0 0.0 1.0) (100 . "AcDbArc") (50 . 1.44196) (51 . 1.64796)) ***in Acad 2009 on Windows Vista Business 32 bit*** Command: (vl-load-com) Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) Select object: ; IAcadCircle: AutoCAD Circle Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 00cdb528> ; Area = 3.94418 ; Center = (5.57887 4.92506 0.0) ; Circumference = 7.04017 ; Diameter = 2.24096 ; Document (RO) = #<VLA-OBJECT IAcadDocument 0e599270> ; Handle (RO) = "7F" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0e89e104> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 2129674296 ; ObjectName (RO) = "AcDbCircle" ; OwnerID (RO) = 2129665960 ; PlotStyleName = "ByLayer" ; Radius = 1.12048 ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0e89e468> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T Command: tr TRIM Current settings: Projection=UCS, Edge=Extend Select cutting edges ... Select objects or <select all>: Specify opposite corner: 3 found Select objects: Select object to trim or shift-select to extend or [Fence/Crossing/Project/Edge/eRase/Undo]: Select object to trim or shift-select to extend or [Fence/Crossing/Project/Edge/eRase/Undo]: Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) Select object: ; IAcadCircle: AutoCAD Circle Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 00cdb528> ; Area = AutoCAD.Application: Invalid class ; Center = AutoCAD.Application: Invalid class ; Circumference = AutoCAD.Application: Invalid class ; Diameter = AutoCAD.Application: Invalid class ; Document (RO) = #<VLA-OBJECT IAcadDocument 0e599270> ; Handle (RO) = "7F" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0e89dfec> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = AutoCAD.Application: Invalid class ; ObjectID (RO) = 2129674296 ; ObjectName (RO) = "AcDbArc" ; OwnerID (RO) = 2129665960 ; PlotStyleName = "ByLayer" ; Radius = AutoCAD.Application: Invalid class ; Thickness = AutoCAD.Application: Invalid class ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 0e89e468> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T Command: (entget (car (entsel))) Select object: ((-1 . <Entity name: 7ef04038>) (0 . "ARC") (330 . <Entity name: 7ef01fa8>) (5 . "7F") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbCircle") (10 5.57887 4.92506 0.0) (40 . 1.12048) (210 0.0 0.0 1.0) (100 . "AcDbArc") (50 . 1.6034) (51 . 1.37457)) ***in Acad 2014 on Windows 7 ultimate 64 bit*** Command: (vl-load-com) Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) Select object: ; IAcadCircle: AutoCAD Circle Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 00000001400ad910> ; Area = 29.9076 ; Center = (19.4428 11.0178 0.0) ; Circumference = 19.3863 ; Diameter = 6.17087 ; Document (RO) = #<VLA-OBJECT IAcadDocument 0000000028535208> ; EntityTransparency = "ByLayer" ; Handle (RO) = "1D4" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000002db93268> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = (0.0 0.0 1.0) ; ObjectID (RO) = 42 ; ObjectID32 (RO) = 42 ; ObjectName (RO) = "AcDbCircle" ; OwnerID (RO) = 43 ; OwnerID32 (RO) = 43 ; PlotStyleName = "ByLayer" ; Radius = 3.08543 ; Thickness = 0.0 ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000002db921e0> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T Command: TR TRIM Current settings: Projection=UCS, Edge=None Select cutting edges ... Select objects or <select all>: Specify opposite corner: 3 found Select objects: Select object to trim or shift-select to extend or [Fence/Crossing/Project/Edge/eRase/Undo]: Select object to trim or shift-select to extend or [Fence/Crossing/Project/Edge/eRase/Undo]: Command: (vlax-dump-object (vlax-ename->vla-object (car (entsel))) T) Select object: ; IAcadCircle: AutoCAD Circle Interface ; Property values: ; Application (RO) = #<VLA-OBJECT IAcadApplication 00000001400ad910> ; Area = AutoCAD.Application: Invalid class ; Center = AutoCAD.Application: Invalid class ; Circumference = AutoCAD.Application: Invalid class ; Diameter = AutoCAD.Application: Invalid class ; Document (RO) = #<VLA-OBJECT IAcadDocument 0000000028535208> ; EntityTransparency = "ByLayer" ; Handle (RO) = "1D4" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000002dc95778> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; Normal = AutoCAD.Application: Invalid class ; ObjectID (RO) = 42 ; ObjectID32 (RO) = 42 ; ObjectName (RO) = "AcDbArc" ; OwnerID (RO) = 43 ; OwnerID32 (RO) = 43 ; PlotStyleName = "ByLayer" ; Radius = AutoCAD.Application: Invalid class ; Thickness = AutoCAD.Application: Invalid class ; TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000002dc95a70> ; Visible = -1 ; Methods supported: ; ArrayPolar (3) ; ArrayRectangular (6) ; Copy () ; Delete () ; GetBoundingBox (2) ; GetExtensionDictionary () ; GetXData (3) ; Highlight (1) ; IntersectWith (2) ; Mirror (2) ; Mirror3D (3) ; Move (2) ; Offset (1) ; Rotate (2) ; Rotate3D (3) ; ScaleEntity (2) ; SetXData (2) ; TransformBy (1) ; Update () T
So, short of closing a drawing and reopening it, how does one get the object type to update after it has been trimmed? In VBA/VB/C# one could try casting the object, but in lisp?
-Gary
Solved! Go to Solution.
Solved by dbroad. Go to Solution.
Try this :
(defun c:tcu nil (trimmedcircleupd (car (entsel "\nPick trimmed circle")))) (defun trimmedcircleupd ( ci / arc ) (vl-load-com) (setq arc (vla-copy (vlax-ename->vla-object ci))) (vla-delete (vlax-ename->vla-object ci)) (vlax-dump-object arc t) (princ) )
M.R.
I ran into the same problem a while ago. You are correct in that it is just plain broke. In my case I was making a routine to draw a belt wrapped around a few pulleys and a tensioner. I found that to do my final polyline join I could use the selection set of the circles prior to the trim command and the new arcs were still included. Prior to finding that, I had tried, vla-update, entmod, and etc. and could not get the info that I needed. In your case if you are just looking for start and end points, then even though the vla-object won't give you what you want, I believe the dxf code will. It includes the center point, radius, start and end angles for the arc and shows the arc correctly after trimming. Stupid, but workable.
Please take a few min to report this to autodesk. You can do so here (it's good for feature requests and bug reports):
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1109794
Also if you're on subscription, open a ticket and report it that way (yes, I'd say do both).
Don Ireland
Engineering Design Technician
Thanks for pointing out this problem. This is not a fix but perhaps might be a workaround. The problem is that all references to the object need to be released before the activeX system will pay attention.
;;pick new circle. (setq c (vlax-ename->vla-object (car(entsel)))) ;;trim circle, now c is a circle without a database but lists as an arc. ;;You can still get its ename and handle (setq en (vlax-vla-object->ename c)) (setq h (vla-get-handle c)) ;;Can't do anything more until you release the object (vlax-release-object c) ;;Regenerate the drawing. (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-regen doc acallviewports) ;;Get the recast arc object without loss of other data. (setq a (vlax-ename->vla-object en))
Perhaps you need to push them a little more. After all, I proprosed a workaround, not a true solution. The regen should really not be required. Probably low on any list to be fixed though.
true... I'll wait till end of day Monday to see if they escalate the issue on here, otherwise I'll create a support ticket through ADN and see if I can get it escalated that way.
BTW: for anyone following this thread and/or finding it in the future as they are looking for a solution...
Under the scenario of acquiring objects in a continuing loop then building annonymous "post-processing" loops based upon information gathered from the objects: ensuring that the object is released, then calling the vla-regen prior to the next loop does the trick,,,
But if you are processing the specific object you can avoid the regen by performing a vla-update on the object, release it, then reacquire it using an intermediate variable for the ename (as per dbroad's post)...
edited to add this:The primary key to both work arounds is to specifically release the object then reacquiring it.
-Gary