Results 1 to 2 of 2

Thread: List the vertices of MPolygon and create vertices

  1. #1
    Member
    Join Date
    2018-02
    Posts
    2
    Login to Give a bone
    0

    Question List the vertices of MPolygon and create vertices

    Hi all,

    I am trying to write a LISP routine to list all the vertices of selected MPolygon.

    I have one MPolygon and 5 polylines. The sample drawing is attached.
    Basically, I want the program to create vertices on the MPolygon where the polylines touch the MPolygon (meaning there is no gap between them) and store the coordinates of all the vertices into a variable.

    Thank you
    Best wishes,
    Jes G
    Attached Files Attached Files

  2. #2
    I could stop if I wanted to
    Join Date
    2005-06
    Location
    CORDOBA-ARGENTINA
    Posts
    275
    Login to Give a bone
    0

    Default Re: List the vertices of MPolygon and create vertices

    Try it

    NO ERROR CHECK

    Code:
    ;; Design by Gabo CALOS DE VIT from CORDOBA ARGENTINA
    ;;;    Copyleft 1995-2018 by Gabriel Calos De Vit 
    ;; DEVITG@GMAIL.COM    
    
    (DEFUN GET-VERTEX-AT-MPOLYGON  (/
    ACAD-OBJ
    ACEXTENDNONE
    ADOC
    ALL-LVCABE
    ALL-LVCABE-OBJ
    LVCABLE@MPLOLIGON-XY
    LVCABLE@MPLOLIGON-XY-LIST
    LVLINE
    LVLINE-OBJ
    LVLINE-OBJ-LAYER
    MODEL
    MPOLY
    MPOLY-OBJ
    OBJ
    SELECTIONSETS
                                   )
    
      (VL-LOAD-COM)
      (SETQ ACAD-OBJ (VLAX-GET-ACAD-OBJECT)) ;_ el programa ACAD 
      (SETQ ADOC (VLA-GET-ACTIVEDOCUMENT ACAD-OBJ)) ;_ el DWG que esta abierto-
      (SETQ MODEL (VLA-GET-MODELSPACE ADOC))
      (SETQ SELECTIONSETS (VLA-GET-SELECTIONSETS ADOC))
      (PRINC "\n select the mpoly")
      (SETQ MPOLY (SSNAME (SSGET ":S" '((0 . "MPOLYGON"))) 0))
      (SETQ MPOLY-OBJ (VLAX-ENAME->VLA-OBJECT MPOLY))
      (PRINC "\n Select one LVLINE ")
      (SETQ LVLINE (SSNAME (SSGET ":S" '((0 . "lwpolyline"))) 0))
      (SETQ LVLINE-OBJ (VLAX-ENAME->VLA-OBJECT LVLINE))
      (SETQ LVLINE-OBJ-LAYER (VLA-GET-LAYER LVLINE-OBJ))
      (SETQ ALL-LVCABE (SSGET "X" (LIST (CONS 0 "lwpolyline") (CONS 8 LVLINE-OBJ-LAYER))))
      (SETQ ALL-LVCABE-OBJ (VLA-GET-ACTIVESELECTIONSET ADOC))
      (SETQ LVCABLE@MPLOLIGON-XY-LIST ())
      (VLAX-FOR LVCABLE-OBJ  ALL-LVCABE-OBJ
        (IF
          (SETQ LVCABLE@MPLOLIGON-XY (VLAX-SAFEARRAY->LIST
                                       (VLAX-VARIANT-VALUE
                                         (VLA-INTERSECTWITH
                                           MPOLY-OBJ
                                           LVCABLE-OBJ
                                           ACEXTENDNONE ;_ Does not extend either object.
                                           ;; acExtendThisEntity ;_Extends the base object.
                                           ;; acExtendOtherEntity ;_ Extends the object passed as an argument.
                                           ;; acExtendBoth    ;;Extends both objects.
                                           ) ;_end intersectwith
                                         ) ;_end vlax-variant-value
                                       ) ;_end vlax-safe->array
                )
           (SETQ LVCABLE@MPLOLIGON-XY-LIST (CONS LVCABLE@MPLOLIGON-XY LVCABLE@MPLOLIGON-XY-LIST))
           ) ;end if
    
        
        ) ;end vlax-for  
      LVCABLE@MPLOLIGON-XY-LIST
      );end defun
    
    (defun c:get-vert()
    (setq vertex (GET-VERTEX-AT-MPOLYGON))
    )

Similar Threads

  1. Replies: 1
    Last Post: 2012-01-05, 09:13 PM
  2. Joining 2 MPOLYGON's with Object data to create Single MPOLYGON
    By pauldeleur in forum AutoCAD Map 3D - General
    Replies: 0
    Last Post: 2008-12-15, 12:21 AM
  3. Creating a list Polyline vertices
    By cadconcepts in forum AutoLISP
    Replies: 4
    Last Post: 2008-07-17, 12:08 AM
  4. Export mpolygon vertices
    By malfan in forum AutoCAD Map 3D - General
    Replies: 1
    Last Post: 2006-11-22, 10:55 PM
  5. Help request compare two vertices list.
    By bprabhakar001 in forum AutoLISP
    Replies: 1
    Last Post: 2006-07-31, 12:01 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •