Results 1 to 4 of 4

Thread: Curve data lisp doesn't work with polyline segments.

  1. #1
    I could stop if I wanted to jpcadconsulting347236's Avatar
    Join Date
    2011-09
    Posts
    258
    Login to Give a bone
    0

    Default Curve data lisp doesn't work with polyline segments.

    Hi folks,

    I got this lisp that inserts a block with curve info (start and end points, radius, length) after selecting an arc... and it works great (thanks to - if I remember - Lee Mac, Tahrwat, and a few other I'm sure).

    It works great when selecting single arcs, but it does not work when selecting polyline segments. The routine doesn't crash, but it populates the block attributes with "####" as it's not pulling data from the polyline segment properly (or at all actually).



    Here is the code. Any help is as always greatly appreciated.

    Code:
    (defun c:CurveTagTEST (/ ent obj CL SCL CID SP EP RAD AL)
    
    (setvar 'ATTDIA 0)
    
    
    (setq CL (getvar "CLAYER"))
    
    
    ;;;;; Collect units information and set scale
    (cond ((= (getvar "INSUNITS") 1) (setq SCL 1))
          ((= (getvar "INSUNITS") 2) (setq SCL 0.08333))
          ((= (getvar "INSUNITS") 4) (setq SCL 25.4))
          ((= (getvar "INSUNITS") 5) (setq SCL 2.54))
          ((= (getvar "INSUNITS") 6) (setq SCL 0.0254))
          (t (alert "Current DWG set to non-standard units.  Check UNITS settings"))
    )
    
    
    (defun GetObjectID ( obj doc )
       ;; Lee Mac
       (if
         (eq "X64"
           (strcase
             (getenv "PROCESSOR_ARCHITECTURE")
           )
         )
         (vlax-invoke-method
           (vla-get-Utility doc) 'GetObjectIdString obj :vlax-false
         )
         (itoa (vla-get-Objectid obj))
       )
     )
    
    
    
    
    
    
    ;;;;; Collect arc data
    
    
    (if (setq ent (car (entsel "\nSelect arc: ")))
    (progn
    
    
    (setq obj (vlax-ename->vla-object ent)
    
    
    AL(strcat "%<\\AcObjProp Object(%<\\_ObjId "
                         (GetObjectID obj doc) ">%).Arclength \\f \"%lu4%pr2\">%"
                       )
    
    
    RAD (strcat "%<\\AcObjProp Object(%<\\_ObjId "
                         (GetObjectID obj doc) ">%).Radius \\f \"%lu4%pr2\">%"
                       )
    
    
    SP (strcat "%<\\AcObjProp Object(%<\\_ObjId "
                         (GetObjectID obj doc) ">%).Startpoint \\f \"%lu4%pt3\">%"
                       )
    
    
    EP (strcat "%<\\AcObjProp Object(%<\\_ObjId "
                         (GetObjectID obj doc) ">%).Endpoint \\f \"%lu4%pt3\">%"
                       )
    )
    )
    )
    
    
    (setq CID (getstring "\nEnter Curve ID: "))
    
    
    
    
    ;;;;; Bring in block "MNLA Curve Tag r00" from Callouts.dwg
    
    
    (defun open_dbx (dwg / dbx)
       (if (< (atoi (substr (getvar "ACADVER") 1 2)) 16)
          (setq dbx (vlax-create-object "ObjectDBX.AxDbDocument"))
          (setq dbx (vlax-create-object
          (strcat "ObjectDBX.AxDbDocument."
             (substr (getvar "ACADVER") 1 2)
             )
          )
       )
    )
    (vla-open dbx dwg)
    dbx
    )
    (setq Dbx (open_dbx "X:/AutoCAD 2018/Drawings/Callouts.dwg"))
    (vla-CopyObjects
    Dbx
    (vlax-safearray-fill
    (vlax-make-safearray vlax-vbObject '(0 . 0))
    (list (vla-item (vla-get-blocks dbx) "MNLA Curve Tag r00"))
    )
    (vla-get-blocks
    (vla-get-activedocument (vlax-get-acad-object))
    )
    )
    (vlax-release-object dbx)
    
    
    
    
    
    
    ;;;;; Insert and populate block
    
    
    (command "-layer" "Make" "L-ANNO-SYMB" "Color" "3" "L-ANNO-SYMB" "Ltype" "CONTINUOUS" "" "Plot" "P" "" "")
    (setvar "CLAYER" "L-ANNO-SYMB")
    
    
    
    
    (setq p (getpoint "\n Specify point :"))
    
    
      (command "_.-insert"
    
    
               "MNLA Curve Tag r00"
               "Scale"
               SCL
               "_none"
    
    
               p
    
    
               ""
    
    
               CID
               AL
               RAD
               SP
               EP
    )
    
    
    (setvar "CLAYER" CL)
    
    
    (princ)
    )
    Attached Images Attached Images
    James Pertusi

    CAD Applications Consultant
    1 (646) 773 4834
    www.jpcadconsulting.com

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

    Default Re: Curve data lisp doesn't work with polyline segments.

    Mine doesn't use fields, but it labels both line and arc segments and doesn't care if they're in a polyline or not. The appropriate block is scaled to the annotation scale with all the information in attributes. Put both the lisp and blocks in one of the Support File Search Path folders. For the arc info I set it to display for easy reading, but it can be remarked out as the block is already labeled.
    Attached Files Attached Files
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

  3. #3
    I could stop if I wanted to jpcadconsulting347236's Avatar
    Join Date
    2011-09
    Posts
    258
    Login to Give a bone
    0

    Default Re: Curve data lisp doesn't work with polyline segments.

    Thanks Tom!

    Would you be Ok with me pillaging this for some useful code?
    James Pertusi

    CAD Applications Consultant
    1 (646) 773 4834
    www.jpcadconsulting.com

  4. #4
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL
    Posts
    3,078
    Login to Give a bone
    0

    Default Re: Curve data lisp doesn't work with polyline segments.

    Quote Originally Posted by jpcadconsulting347236 View Post
    Thanks Tom!

    Would you be Ok with me pillaging this for some useful code?
    No problem, old routine that I'm glad someone found a use for.
    Tom Beauford P.S.M. - Civil 2019 on Windows 10 Enterprise
    Design Analysis - Leon County Public Works/Engineering Wrap [CODE] tags around selected text
    2280 Miccosukee Rd. Tallahassee, FL 32308-5310
    Ph# (850)606-1516 Home Page

Similar Threads

  1. Replies: 6
    Last Post: 2019-01-15, 09:08 PM
  2. 2015: Extracting curve data from 3D Polyline
    By CCarleton in forum AutoCAD Civil 3D - General
    Replies: 6
    Last Post: 2016-03-30, 10:43 PM
  3. Lisp routine doesn't work
    By boyerd492098 in forum AutoLISP
    Replies: 16
    Last Post: 2015-01-27, 10:13 PM
  4. why doesn't this lisp work in a macro?
    By chuh in forum AutoLISP
    Replies: 12
    Last Post: 2014-09-09, 05:56 PM
  5. Curve Between 2 Lines command doesn't work
    By ewhite in forum Land Desktop - General
    Replies: 5
    Last Post: 2006-08-30, 04:47 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
  •