Results 1 to 3 of 3

Thread: Profile from File ?

  1. #1
    Certified AUGI Addict cadtag's Avatar
    Join Date
    2000-12
    Location
    Cairo - no, not Illinois
    Posts
    5,069
    Login to Give a bone
    0

    Default Profile from File ?

    On the profile pulldown, there's an option to Create a Profile from a File. When selected, this defaults to a .txt format

    The question is -- is there a way in C3D to _create_ that text file from a profile?

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Profile from File ?

    The toolbox has some tools that will extract the data, but it does not create that file format specifically.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Profile from File ?

    I'm slow today. Will this work?
    Code:
    (defun c:ExportProfile (/ AT:WriteToFile op:ExportProfile sFile)
    ;;; Write list to file
    ;;; #File - file to write list to (must be in form "c:\\File.txt")
    ;;; #ListToWrite - list to write to file
    ;;; #Overwrite - If T, will overwrite; nil to append
    ;;; Alan J. Thompson, 04.28.09
    ;;; https://forums.augi.com/showthread.php?117203-open-and-read-text-file&p=1059711&viewfull=1#post1059711
      (defun AT:WriteToFile (#File #ListToWrite #Overwrite / #FileOpen)
        (cond ((and (vl-consp #ListToWrite)
                    (setq #FileOpen (open #File
                                          (if #Overwrite
                                            "W"
                                            "A"
                                          ) ;_ if
                                    ) ;_ open
                    ) ;_ setq
               ) ;_ and
               (foreach x #ListToWrite
                 (write-line (vl-princ-to-string x) #FileOpen)
               ) ;_ foreach
               (close #FileOpen)
               t
              )
        ) ;_ cond
      ) ;_ defun
      (defun op:ExportProfile ( oProfile / oPVIs lPVIs sData)
        (if (setq oPVIs (vlax-get-property oProfile 'PVIs))
          (vlax-for n oPVIs
            (if
              (and (not lPVIs) (vlax-property-available-p n 'CurveLength))
               (exit)
            )
            (setq
              sData (strcat (rtos (vlax-get-property n 'Station) 2 2)
                            " "
                            (rtos (vlax-get-property n 'Elevation) 2 2)
                    )
            )
            (if (vlax-property-available-p n 'CurveLength)
              (setq
                sData
                 (strcat sData
                         " "
                         (rtos (vlax-get-property n 'CurveLength) 2 2)
                 )
              )
            )
            (setq lPVIs (append lPVIs (list sData)))
          )
        )
        lPVIs
      )
    
      (if (and (setq oProfile (entsel "\nSelect profile: "))
               (= (type oProfile) 'list)
               (= (type (car oProfile)) 'ENAME)
               (setq oProfile (car oProfile))
               (setq oProfile (vlax-ename->vla-object oProfile))
               (= (vla-get-objectName oProfile) "AeccDbVAlignment")
               (= (vlax-get-property oProfile 'Type) 2)
               (setq sName (vla-get-name oProfile))
               (setq sFile (getfiled "Export Profile" (strcat (getvar 'dwgprefix) sName ".txt") "txt" 1))
               (setq lPVIs (op:ExportProfile oProfile))
          )
        (AT:WriteToFile sFile lPVIs t)
      )
    )
    I'm not going to document it, but it does need one more check on the last segment to verify it does not have a curve property. Also, the vertical curves, per the C3D documentation, are assumed to be parabolic.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

Similar Threads

  1. 2018: Labeling two Proposed Profiles on a Profile View
    By mr756944 in forum AutoCAD Civil 3D - Profiles
    Replies: 10
    Last Post: 2022-10-31, 02:32 PM
  2. Profile Labels / Plan-Profile sheets.
    By jbbarrus in forum AutoCAD Civil 3D - Profiles
    Replies: 1
    Last Post: 2006-11-10, 07:35 PM
  3. Replies: 3
    Last Post: 2006-01-17, 11:26 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
  •