+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Full Member
    Computer Details
    chiimayred's Computer Details
    Operating System:
    Windows 7 64-bit
    Using
    Civil 3D 2014
    Join Date
    Jul 2013
    Posts
    48

    Default Working Point Lisp

    Registered forum members do not see this ad.

    Hey guys,

    I'm trying to make a lisp where the user would pick a point in the model and the lisp would create a multileader in paperspace with the coordinates pulled from the model.

    Here's the code I got so far:

    Code:
     (defun c:test (/ WorkingPoint Easting Northing Point)
      (command
        "_.mspace"
        );;end command
      (setq WorkingPoint (getpoint "\nWhere is Working Point?: "))
      (setq Northing (cadr WorkingPoint));;set "y" value of WorkingPoint to Northing
      (setq Easting (car WorkingPoint));;set "x" value of WorkingPoint to Easting
      (command
        "_.point" WorkingPoint
        );;end command
      (setq point (entlast));;set the workingpoint to point
      (command
        "_.chspace" point "" ""
        );;end command
      (setq pspaceworkingpoint (entget point))
      (setq mleaderinspt (list (car pspaceworkingpoint)(cadr pspaceworkingpoint)))
      (princ mleadinspt)
      );;end defun
    Whenever I run this, for the "mleaderinspt" variable I get

    Code:
    nilnil
    What I want to do is create the multileader insert point where the user picked the original working point but I'm having a hard time translating that to the paperspace.

    Please note I haven't added error checking yet as this is still in the developmental phase/proof of concept.

    Any and all help is appreciated.

    Thanks!

    EDIT: Think I figured it out, I'll update this thread if it works.
    Last edited by chiimayred; 30th Oct 2014 at 07:40 pm.

  2. #2
    Full Member
    Computer Details
    chiimayred's Computer Details
    Operating System:
    Windows 7 64-bit
    Using
    Civil 3D 2014
    Join Date
    Jul 2013
    Posts
    48

    Default

    Ok so here is where I'm at:

    Code:
    (defun c:test (/ WorkingPoint Easting Northing Point)
      (command
        "_.mspace"
        );;end command
      (setq WorkingPoint (getpoint "\nWhere is Working Point?: "))
      (setq Northing (cadr WorkingPoint));;set "y" value of WorkingPoint to Northing
      (setq Easting (car WorkingPoint));;set "x" value of WorkingPoint to Easting
      (command
        "_.point" WorkingPoint
        );;end command
      (setq point (entlast));;set the workingpoint to point
      (command
        "_.chspace" point "" ""
        );;end command
      (setq pspacepoint (entget point))
      (setq pspace (cdr (assoc 10 pspacepoint)))
      (command
        "_.mleader" pspace "@10,-10" "WORKING POINT N "
        )
      );;end defun
    I'm having a problem getting the multileader to input the text... the typical format we use is:

    WORKING POINT
    N: XXXXX
    E: XXXXX

    I don't know how to get it to display like this... thoughts? I tried to use "strcat" but it won't accept integers from my research.

    Also the coordinates that do come out, come out something like this "2.485834611853077E+005" and I just need it to be "248583.46", any ideas on how to remedy this as well?

    Thanks!

  3. #3
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,232

    Default

    Code:
    Command: (rtos (atof "2.485834611853077E+005") 2 2)
    "248583.46"

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  4. #4
    Full Member
    Computer Details
    chiimayred's Computer Details
    Operating System:
    Windows 7 64-bit
    Using
    Civil 3D 2014
    Join Date
    Jul 2013
    Posts
    48

    Default

    Perfect! That helps me out with one of my issues

  5. #5
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,892

    Default

    Your using a lot of reserved words point, pspsace for variable names not a good idea, this may be creating problems.
    A man who never made mistakes never made anything

  6. #6
    Full Member
    Computer Details
    chiimayred's Computer Details
    Operating System:
    Windows 7 64-bit
    Using
    Civil 3D 2014
    Join Date
    Jul 2013
    Posts
    48

    Default

    Registered forum members do not see this ad.

    I figured something out that'll work for now, the formatting is a little off but the user can fix it (and will probably need to to name the working point) by editing the leader.

    Code:
    (defun c:test (/ WorkingPoint Easting Northing Point PSPACEPOINT PSPACE TEXT TEXTPROPS COORD)
        (command
        "_.mspace"
        );;end command
      (setq WorkingPoint (getpoint "\nWhere is Working Point?: "))
      (setq Northing (rtos (cadr WorkingPoint) 2 1));;set "y" value of WorkingPoint to Northing
      (setq Easting (rtos (car WorkingPoint) 2 1));;set "x" value of WorkingPoint to Easting
      (command
        "_.point" WorkingPoint
        );;end command
      (setq point (entlast));;set the workingpoint to point
      (command
        "_.chspace" point "" "";;this brings the workingpoint set in the modelspace to paperspace
        );;end command
      (setq pspacepoint (entget point));;get the properties for point
      (setq pspace (cdr (assoc 10 pspacepoint)));;find the x&y coords and set to pspace
      (COMMAND
        "mTEXT" PSPACE "@20,-20" "WORKING POINT" "N:"NORTHING "E:"EASTING ""
        );;END COMMAND
         (setq text (entlast));;set mtext to variable text
         (setq textprops (entget text));;get the properties from text
         (setq coord (cdr (assoc 1 textprops)));;find the string properties and set to coord
         (command
        "_.mleader" pspace "@10,-10" coord
        "_.erase" point text ""
        );;END COMMAND
      );;end defun

Similar Threads

  1. MULTIPLE - POINT command not working???
    By scassidy15 in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 14th Nov 2011, 05:37 am
  2. NEntSelP not working if point not in view?!
    By chavlji in forum AutoLISP, Visual LISP & DCL
    Replies: 14
    Last Post: 12th Nov 2010, 08:41 am
  3. Copy with base Point function not working
    By lenmac in forum AutoCAD Beginners' Area
    Replies: 11
    Last Post: 22nd Sep 2009, 02:53 pm
  4. Paste with base point quit working?
    By longcrier in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 9th Dec 2008, 07:00 pm
  5. Insert/Copy w/base point not working
    By brassworks in forum AutoCAD Drawing Management & Output
    Replies: 13
    Last Post: 14th Dec 2007, 07:15 pm

Tags for this Thread

Bookmarks

Posting Permissions

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