Aftertouch Posted June 27, 2023 Posted June 27, 2023 Hi All, I cannot seem to find much information about MPOLYGONs on the interwebs.... Adding a vertex to a MPolygon with MAPMPEDIT is a pain in the ass... Would there be a simpeler way to add a vertex on a selected point? Does anybout have any experienct with adding vertexes to MPOLYGON by using LISP? Quote
BIGAL Posted June 28, 2023 Posted June 28, 2023 What does dumpit show for a mpolygon. Hopefully co-ordinates. ;;;===================================================================; ;;; DumpIt ; ;;;-------------------------------------------------------------------; ;;; Dump all methods and properties for selected objects ; ;;;===================================================================; (defun C:Dumpit ( / ent) (while (setq ent (entsel "\n pick object ")) (vlax-Dump-Object (vlax-Ename->Vla-Object (car ent)) ) ) (princ) ) 1 Quote
Aftertouch Posted June 28, 2023 Author Posted June 28, 2023 @BIGAL, negative. pick object ; IAcMPolygon: AcMPolygon Interface ; Property values: ; Angle = 0.0 ; Application (RO) = #<VLA-OBJECT IAcadApplication 00007ff6f3485110> ; Area (RO) = 1851.63 ; Document (RO) = #<VLA-OBJECT IAcadDocument 0000012b5a03a798> ; Double = 0 ; Elevation = 0.0 ; EntityTransparency = "ByLayer" ; GradientAngle = 0.0 ; GradientCentered = -1 ; GradientColor1 = Er is een uitzondering opgetreden ; GradientColor2 = Er is een uitzondering opgetreden ; GradientName = "" ; Handle (RO) = "632" ; HasExtensionDictionary (RO) = 0 ; Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 0000012b2cd57818> ; Layer = "0" ; Linetype = "ByLayer" ; LinetypeScale = 1.0 ; Lineweight = -1 ; Material = "ByLayer" ; ObjectID (RO) = 42 ; ObjectName (RO) = "AcDbMPolygon" ; OwnerID (RO) = 43 ; PatternFillTrueColor = #<VLA-OBJECT IAcadAcCmColor 0000012b2cd57150> ; PatternName = "_SOLID" ; PatternTypeAsString = "Predefined" ; Perimeter (RO) = 198.29 ; PlotStyleName = "ByLayer" ; Scale = 1.0 ; Spacing = 1.0 ; TrueColor = #<VLA-OBJECT IAc A simple 'entget' shows me this: Select object: ((-1 . <Entity name: 12b329d2ba0>) (0 . "MPOLYGON") (330 . <Entity name: 12b59b6b1f0>) (5 . "632") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbMPolygon") (70 . 1) (10 0.0 0.0 0.0) (210 0.0 0.0 1.0) (2 . "_SOLID") (71 . 1) (91 . 1) (92 . 2) (73 . 0) (72 . 0) (93 . 5) (10 -15.8277 -62.1936 0.0) (10 25.5932 -81.4335 0.0) (10 57.4882 -52.8692 0.0) (10 20.988 -42.7435 0.0) (10 -30.1315 -47.3761 0.0) (76 . 1) (63 . 256) (11 38.75 40.25 0.0) (99 . 0) (450 . 0) (451 . 0) (460 . 0.0) (461 . 0.0) (452 . 0) (462 . 0.0) (453 . 0) (470 . "")) BUT The 'assoc 11' is the original 'centerpoint' of the object. When i start stretching the corner points, the 'assoc 10' is changing, relative to group 11. Even if i move the entity 100 km away, group 11 never changes, and the group 10 codes are relative to group 11. Soo.... if i want to select a MPOLYGON, and click 'somewhere' to add the new vertex, i need the calculate the relative coordinates, based on group 11. But als calculate where exactly that coordinate needs to be placed within the list, before i can do and entmod function. But when the MPolygon has a hole in it, it becomes alot more fun.... Select object: ((-1 . <Entity name: 12b9cf7bf20>) (0 . "MPOLYGON") (330 . <Entity name: 12b59b6b1f0>) (5 . "75A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbMPolygon") (70 . 1) (10 0.0 0.0 0.0) (210 0.0 0.0 1.0) (2 . "_SOLID") (71 . 1) (91 . 2) (92 . 2) (73 . 0) (72 . 0) (93 . 4) (10 -9.1804 2.93211 0.0) (10 4.40659 2.93211 0.0) (10 4.40659 -9.16283 0.0) (10 -9.1804 -9.16283 0.0) (92 . 2) (73 . 0) (72 . 0) (93 . 4) (10 -31.2134 25.6559 0.0) (10 -31.2134 -25.6559 0.0) (10 31.2134 -25.6559 0.0) (10 31.2134 25.6559 0.0) (76 . 1) (63 . 256) (11 190.408 16.5577 0.0) (99 . 0) (450 . 0) (451 . 0) (460 . 0.0) (461 . 0.0) (452 . 0) (462 . 0.0) (453 . 0) (470 . "")) Now i have two 'bundles' of group 10 coordinates, one of the outline and one of the inner boundary. Lets not mention MPolygons, with an arced segment in it... Quote
BIGAL Posted June 28, 2023 Posted June 28, 2023 Thanks for posting have no idea, post a before and after dwg. Quote
Aftertouch Posted June 28, 2023 Author Posted June 28, 2023 I hope this makes any sense. DWG attatched. MPoly.dwg Quote
Aftertouch Posted July 5, 2023 Author Posted July 5, 2023 Unfortunately i still havent been able to solve this case. Quote
BIGAL Posted July 6, 2023 Posted July 6, 2023 The dxf 10 holds lots of stuff need to look into it more, may be a way to add a 10 value. (setq plent (entsel "\nPick mpoly ")) (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) Dxf 11 is part of the sequence and matches the 1st dxf 10 0,0,0 in some way have not checked. dxf 93 appears to be number of vertices. Could not find any reference to dxf codes for Mpoly. Try this (dumpallproperties (car (entsel))) should reveal a lot more. Quote
Tsuky Posted July 6, 2023 Posted July 6, 2023 @Aftertouch May be a solution! Not very clean, but simple. The principle consists in being able to use the contextual menu with the grips (add or delete a vertex) of a polyline. The use is not very simple, it is necessary to validate "Edit", to add the vertex by the contextual menu of the grip and to redo "Edit" to again add another vertex. But once you get the hang of using it, it can do the job. (defun c:Mdf_vtx-mpolygon ( / ss mark mk next key e_last) (princ "\nSelect a MPolygon: ") (while (not (setq ss (ssget "_+.:E:S" '((0 . "MPOLYGON")))))) (entmake '((0 . "POINT") (10 0.0 0.0 0.0))) (setq mark (entlast) mk mark) (command "_.explode" (ssname ss 0)) (if (and mark (entget mark)) (progn (setq ss nil ss(ssadd)) (while (setq next (entnext mark)) (ssadd next ss) (setq mark next) ) ss ) ) (sssetfirst nil ss) (initget "Edit Quit") (while (eq (setq key (getkword "\n[Edit/Quit]<Q>: ")) "Edit") (command pause pause) (initget "Edit Quit") ) (command "_.mpolygon" "_select" ss "" "_exit") (setq e_last (entlast)) (while (not (eq (entlast) mk)) (entdel (entlast)) ) (entdel mk) (entdel e_last) (prin1) ) Quote
BIGAL Posted July 7, 2023 Posted July 7, 2023 I think explode the mpoly make changes to the 2 plines, then remake the mpoly, its has 2 sequences of dxf 10 controlled by the dxf 93, looking at this sort of defun need to add all the correct dxf codes in sequence. It may be possible to leave some out. (defun LWPoly (lst cls) (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length lst)) (cons 70 cls)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) So the polyline has 90 the number of vertices and the mapcar makes the dxf 10 vertices, this would need to be done twice. As per the mpoly dwg need to duplicate the entget output. Will try to find time have a couple of to do's ahead of it. 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.