Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Export drawing objects coordinates

  1. #11
    100 Club
    Join Date
    2002-08
    Posts
    184
    Login to Give a bone
    0

    Default Re: Export drawing objects coordinates

    For your request change simply:
    line 47
    Code:
    (vlax-3d-point (setq pt (polar pt_start (+ alpha (* pi 0.5)) (getvar "TEXTSIZE"))))
    by
    Code:
    (vlax-3d-point pt_start)
    and line 57
    Code:
    (list 8 (getvar "TEXTSIZE") 5 pt "ELEV_ARIAL_1" (cdr (assoc 8 dxf_ent)) alpha)
    by
    Code:
    (list 5 (getvar "TEXTSIZE") 5 pt_start "ELEV_ARIAL_1" (cdr (assoc 8 dxf_ent)) alpha)

  2. #12
    Member
    Join Date
    2010-11
    Posts
    6
    Login to Give a bone
    0

    Default Re: Export drawing objects coordinates

    excellent; Thanks

  3. #13
    Member
    Join Date
    2010-11
    Posts
    6
    Login to Give a bone
    0

    Default Re: Export drawing objects coordinates

    Hi Bruno,
    one last update what if I want to show the length of the selected lines at the end of each line instead of the x or y. or at an offset distance along with the x or y like. x et end of the line and distance at 2 units away from the x value. I tried using the midlength lisp from leemac to modify your code to get the distances on the same layer but no success.
    Thanks

  4. #14
    100 Club
    Join Date
    2002-08
    Posts
    184
    Login to Give a bone
    0

    Default Re: Export drawing objects coordinates

    Quote Originally Posted by Abusaru View Post
    Hi Bruno,
    one last update what if I want to show the length of the selected lines at the end of each line instead of the x or y. or at an offset distance along with the x or y like. x et end of the line and distance at 2 units away from the x value. I tried using the midlength lisp from leemac to modify your code to get the distances on the same layer but no success.
    Thanks
    A change for exemple for length with field.
    Code:
    (vl-load-com)
    (defun c:label_length ( / l_var js htx AcDoc Space nw_style n obj ename dxf_ent pt_start pt_end deriv alpha nw_obj)
      (setq l_var (mapcar 'getvar '("AUNITS" "AUPREC" "LUPREC" "LUNITS")))
      (mapcar 'setvar '("AUNITS" "AUPREC" "LUPREC" "LUNITS") '(4 3 2 2))
      (princ "\nSelect lines.")
      (while (null (setq js (ssget (list
            '(0 . "*POLYLINE,LINE,ARC,CIRCLE")
            (cons 67 (if (eq (getvar "CVPORT") 1) 1 0))
            (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model"))
            '(-4 . "<NOT")
              '(-4 . "&")
              '(70 . 112)
            '(-4 . "NOT>")
          ))))
        (princ "\nSelection is empty or isn't LINE,POLYLINE,ARC or CIRCLE!")
      )
      (initget 6)
      (setq htx (getdist (getvar "VIEWCTR") (strcat "\nSpecify text height <" (rtos (getvar "TEXTSIZE")) ">: ")))
      (if htx (setvar "TEXTSIZE" htx))
      (setq
        AcDoc (vla-get-ActiveDocument (vlax-get-acad-object))
        Space
        (if (= 1 (getvar "CVPORT"))
          (vla-get-PaperSpace AcDoc)
          (vla-get-ModelSpace AcDoc)
        )
      )
      (vla-startundomark AcDoc)
      (cond
        ((null (tblsearch "STYLE" "ELEV_ARIAL_1"))
          (setq nw_style (vla-add (vla-get-textstyles AcDoc) "ELEV_ARIAL_1"))
          (mapcar
            '(lambda (pr val)
              (vlax-put nw_style pr val)
            )
            (list 'FontFile 'Height 'ObliqueAngle 'Width 'TextGenerationFlag)
            (list (strcat (getenv "windir") "\\fonts\\arial.ttf") 0.0 0.0 1.0 0.0)
          )
        )
      )
      (repeat (setq n (sslength js))
        (setq
          obj (ssname js (setq n (1- n)))
          ename (vlax-ename->vla-object obj)
          dxf_ent (entget obj)
          pt_start (vlax-curve-GetStartPoint ename)
          pt_end (vlax-curve-GetEndPoint ename)
          deriv (vlax-curve-getFirstDeriv ename  (vlax-curve-getStartParam ename))
          alpha (- (atan (cadr deriv) (car deriv)) (angle '(0 0 0) (getvar "UCSXDIR")))
        )
        (if (and (< alpha (* pi 0.5)) (> alpha (* pi 1.5))) (setq alpha (+ alpha pi)))
        (setq nw_obj
          (vla-addMtext Space
            ;(vlax-3d-point (setq pt (polar pt_start (+ alpha (* pi 0.5)) (getvar "TEXTSIZE"))))
            (vlax-3d-point pt_start)
            0.0
        (strcat
          "{\\fArial|b0|i0|c0|p34;"
          "%<\\AcObjProp.16.2 Object(%<\\_ObjId "
          (itoa (vla-get-ObjectID ename))
          ">%)."
          (cond
            ((eq (vla-get-ObjectName ename) "AcDbArc")
              "ArcLength"
            )
            ((eq (vla-get-ObjectName ename) "AcDbCircle")
              "Circumference"
            )
            (T
              "Length"
            )
          )
          " \\f \"%lu2%pr2%ps[L=,"
          "m]\">%"
        )
          )
        )
        (mapcar
          '(lambda (pr val)
            (vlax-put nw_obj pr val)
          )
          (list 'AttachmentPoint 'Height 'DrawingDirection 'InsertionPoint 'StyleName 'Layer 'Rotation)
          ;(list 8 (getvar "TEXTSIZE") 5 pt "ELEV_ARIAL_1" (cdr (assoc 8 dxf_ent)) alpha)
          (list 5 (getvar "TEXTSIZE") 5 pt_start "ELEV_ARIAL_1" (cdr (assoc 8 dxf_ent)) alpha)
        )
      )
      (vla-endundomark AcDoc)
      (mapcar 'setvar '("AUNITS" "AUPREC" "LUPREC" "LUNITS") l_var)
      (prin1)
    )

  5. #15
    Member
    Join Date
    2010-11
    Posts
    6
    Login to Give a bone
    0

    Default Re: Export drawing objects coordinates

    Thanks once again

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Export coordinates to Excel
    By rputhenv in forum AutoCAD General
    Replies: 5
    Last Post: 2016-10-14, 02:09 PM
  2. Replies: 1
    Last Post: 2016-06-17, 08:20 PM
  3. 2013: How do I export to IFC with project coordinates and not real world coordinates?
    By m.knutsson in forum Revit Architecture - General
    Replies: 2
    Last Post: 2013-10-15, 06:54 AM
  4. export line coordinates
    By spamkiller433238 in forum AutoLISP
    Replies: 9
    Last Post: 2011-12-19, 12:46 AM
  5. Export Coordinates
    By Maastricht in forum AutoCAD Map 3D - General
    Replies: 3
    Last Post: 2009-08-19, 04:45 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
  •