See the top rated post in this thread. Click here

Results 1 to 4 of 4

Thread: Modification to a lisp (needs to change the lisp code)

  1. #1
    Login to Give a bone
    0

    Default Modification to a lisp (needs to change the lisp code)

    Dear Valuable Members,

    Hoping I will get a solution from you guys. I have a lisp that can erase all entities inside a selected boundary. But I need to change it as It Should erase outside the selected boundary. The existing lisp code is below. Please change the code as I require. Thanks in advance. Please do email to nanaji130285@gmail.com

    Code:
    (defun c:EIB ()
    (vl-load-com)
    (inivar)
    (princ
    "\nPick a CLOSED POLYLINE (and everything inside will be erased)..."
    )
    (setq CLOSEDPOLY
    (vlax-ename->vla-object
    (car (entsel "\nSelect object :"))
    )
    )
    (if (/= CLOSEDPOLY nil)
    (progn
    (setq POLYTRUEFALSE
    (vlax-get-property CLOSEDPOLY 'objectname)
    )
    (if (= POLYTRUEFALSE "AcDbPolyline")
    (progn
    (setq CLOSEDTRUEFALSE
    (vlax-get-property
    CLOSEDPOLY
    'closed
    )
    )
    (if (/= CLOSEDTRUEFALSE :vlax-true)
    (progn
    (setq CLOSEDPOLY nil)
    (princ "\nThe POLYLINE isn't CLOSED...")
    )
    )
    )
    (progn
    (setq CLOSEDPOLY nil)
    (princ "\nSelect a POLYLINE...")
    )
    )
    )
    )
    (while (= CLOSEDPOLY nil)
    (progn
    (princ "\nNothing Selected...")
    (setq CLOSEDPOLY
    (vlax-ename->vla-object
    (car (entsel "\nSelect object :"))
    )
    )
    (if (/= CLOSEDPOLY nil)
    (progn
    (setq POLYTRUEFALSE
    (vlax-get-property CLOSEDPOLY 'objectname)
    )
    (if (= POLYTRUEFALSE "AcDbPolyline")
    (progn
    (setq CLOSEDTRUEFALSE
    (vlax-get-property CLOSEDPOLY 'closed)
    )
    (if (/= CLOSEDTRUEFALSE :vlax-true)
    (progn
    (setq CLOSEDPOLY nil)
    (princ "\nThe POLYLINE isn't CLOSED...")
    )
    )
    )
    (progn
    (setq CLOSEDPOLY nil)
    (princ "\nSelect a POLYLINE...")
    )
    )
    )
    )
    )
    )
    (setq ENDPARAM (fix (vlax-curve-getEndParam CLOSEDPOLY)))
    (setq COUNT 0)
    (setq listapt nil)
    (while (<= COUNT ENDPARAM)
    (progn
    (setq xy (vlax-curve-getPointAtParam CLOSEDPOLY COUNT))
    (setq listapt (append listapt (list xy)))
    (setq COUNT (1+ COUNT))
    )
    )
    (setq lengthlista (length listapt))
    (setq pt1 (nth (- lengthlista 2) listapt)
    pt2 (nth (1- lengthlista) listapt)
    )
    (setq strpt1 (vl-princ-to-string pt1)
    strpt2 (vl-princ-to-string pt2)
    )
    (if (= strpt1 strpt2)
    (progn
    (setq listapt (vl-remove pt1 listapt))
    )
    )
    (setq selset (ssget "_WP" listapt))
    (if (/= selset nil)
    (progn
    (setq selnumb (sslength selset))
    (setq COUNT 0)
    (while (< COUNT selnumb)
    (progn
    (setq ent (ssname selset count))
    (entdel ent)
    (setq COUNT (1+ COUNT))
    )
    )
    )
    (princ "\nNo objects to erase...")
    )
    (EICP)
    (princ)
    )
    ;;;-------------------;;;
    (defun inivar ()
    (setq cmd_ini (getvar "cmdecho")
    fla_ini (getvar "flatland")
    osm_ini (getvar "osmode")
    ort_ini (getvar "orthomode")
    plt_ini (getvar "plinetype")
    aup_ini (getvar "auprec")
    uni_ini (getvar "unitmode")
    lun_ini (getvar "lunits")
    diz_ini (getvar "dimzin")
    edg_ini (getvar "edgemode")
    )
    (setvar "CMDECHO" 0)
    (setvar "FLATLAND" 0)
    (setvar "OSMODE" 0)
    (setvar "ORTHOMODE" 0)
    (setvar "PLINETYPE" 2)
    (setvar "AUPREC" 0)
    (setvar "UNITMODE" 1)
    (setvar "LUNITS" 2)
    (setvar "DIMZIN" 0)
    (setvar "EDGEMODE" 1)
    )
    ;;;-------------------;;;
    (defun EICP ()
    (setvar "CMDECHO" cmd_ini)
    (setvar "FLATLAND" fla_ini)
    (setvar "OSMODE" osm_ini)
    (setvar "ORTHOMODE" ort_ini)
    (setvar "PLINETYPE" plt_ini)
    (setvar "AUPREC" aup_ini)
    (setvar "UNITMODE" uni_ini)
    (setvar "LUNITS" lun_ini)
    (setvar "DIMZIN" diz_ini)
    (setvar "EDGEMODE" edg_ini)
    )
    ;;;--------------------end of routine-------------------------;;;
    Last edited by Opie; 2020-04-28 at 03:21 PM. Reason: [code] tags added - Opie

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,655
    Login to Give a bone
    1

    Default Re: Modification to a lisp (needs to change the lisp code)

    You need to Wrap Code tags around any code you post.

    Clicking the [Go Advanced] button at the bottom puts a toolbar at the top and the # icon in that toolbar places code tags around [code]selected text[/code] for you or simply paste your code inside.

    Getting the most relevant answers to your question
    Last edited by Tom Beauford; 2020-02-28 at 12:59 PM.

  3. #3
    All AUGI, all the time
    Join Date
    2003-07
    Posts
    555
    Login to Give a bone
    0

    Default Re: Modification to a lisp (needs to change the lisp code)

    Search for cookiecutter.lsp it does something similar and may be what you want, does inside or outside.

  4. #4
    Login to Give a bone
    0

    Default Re: Modification to a lisp (needs to change the lisp code)

    Thanks alot for reply. I will see.

Similar Threads

  1. select result lisp modification
    By chad.beussink in forum AutoLISP
    Replies: 10
    Last Post: 2023-10-24, 09:55 AM
  2. Small Modification Required, In Existing Lisp
    By prasadcivil in forum AutoLISP
    Replies: 2
    Last Post: 2016-10-11, 05:45 AM
  3. Modification to a LISP routine
    By cwjean76 in forum AutoLISP
    Replies: 2
    Last Post: 2008-05-19, 06:32 PM
  4. Brick Lisp modification requested
    By BCrouse in forum AutoLISP
    Replies: 0
    Last Post: 2008-04-17, 08:15 PM

Posting Permissions

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