AllExperts > Experts 
Search      

CAD

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More CAD Answers
Question Library

Ask a question about CAD
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About <font color=#6b238e>J. </font><font color=#ff7f00>B. </font><font color=#0000ff>Borge</font>
Expertise
I can address general questions regarding Autocad, Autocad Mechanical, Land Desktop, & Solid Works

Experience
I've been in the 3D/2D CAD industry for 10 yrs. & also had the opportunity/exposure to operate with several mainstream design packages. I've assisted many firms facilitate their 3D migration process.
 
   

You are here:  Experts > Computing/Technology > Computer-Aided Design > CAD > How do I represent an XLS serie (X,Y,Z) in CAD??

Topic: CAD



Expert: <font color=#6b238e>J. </font><font color=#ff7f00>B. </font><font color=#0000ff>Borge</font>
Date: 9/7/2006
Subject: How do I represent an XLS serie (X,Y,Z) in CAD??

Question
Hi Mr expert,
 I have an XLS file with 3 columns for the three coordenates (x,y,z) and I need to represent them on a 3d graphic on AUTOCAD 2006 3D. This 3d line will be used as a path on 3dstudio max 5.0 for an animation.

The Cad file must be a .DXF for the import process on 3ds. I've seen a program called innersoft that seems to do it but i can't try it on the trial version.


Is there any command to perform this 3d line from the xls file instead of introducing the points one by one?

 Thank you in advance.

  Ignacio Peņa


Answer
Ignacio,

My appologies for the delay. You can easily reproduce polylines thru using your excel data by using the Lisp routine provided below. The lisp requires you to have a comma-delimited text file instead. This can be easily created using a save as in Excel. Load the lisp routine, type 'pl3' to start routine, & a points file dialog box should appear. Map to the location of the text file that contains the required point coordinates. The polyline should be created in the current layer. Hope this helps, let me know!

-Regards
J. B. Borge



;;;Start Copy Here;;;
;;;
(defun err (s)
 (if (= s "Function cancelled")
   (princ "IMPORT-3D-POLY - cancelled: ")
   (progn (princ "IMPORT-3D-POLY - Error: ")
     (princ s)
     (terpri)
   ) ;_ progn
 ) ; if
 (resetting)
 (princ "SYSTEM VARIABLES have been reset\n")
 (princ)
) ; err
(defun setv (systvar newval)
 (setq x (read (strcat systvar "1")))
 (set x (getvar systvar))
 (setvar systvar newval)
) ; setv
(defun setting ()
 (setq oerr *error*)
 (setq *error* err)
 (setv "CMDECHO" 0)
 (setv "BLIPMODE" 0)
) ; end of setting
(defun rsetv (systvar)
 (setq x (read (strcat systvar "1")))
 (setvar systvar (eval x))
) ; restv
(defun resetting ()
 (rsetv "CMDECHO")
 (rsetv "BLIPMODE")
 (setq *error* oerr)
) ; end of resetting

(defun poly3D ()
 (setq   ptlist1   (get-ptlist))
 (make-3dpolyline ptlist1)
) ;_ poly3D

(defun get-ptlist ()
 (setq   fn    (getfiled "3D points file" "" "txt" 8)
  f     (open fn "r")
  str   (read-line f)
  plist nil
 ) ;_ end of setq
 (while (/= str EOF)
   (setq str (read-line f))
   (if   str
     (progn
  (setq pt (get-pt str))
  (setq plist (append plist (list pt)))
     ) ;_ end of progn
   ) ;_ end of if
 ) ;_ end of while
 (setq f (close f))
 plist
) ;_ get-ptlist

(defun get-pt (str1)
 (setq   comma (chr 44)
  str2  ""
  count 1
  i     0
 ) ;_ end of setq
 (repeat 2
   (repeat (strlen str1)
     (setq char (substr str1 (setq i (1+ i)) 1))
     (if (/= char comma)
  (setq str2 (strcat str2 char))
  (progn
    (if (= count 1)
      (progn
        (setq x (atof str2))
        (setq str1 (substr str1 (1+ i)))
        (setq i 0)
        (setq count 2)
        (setq str2 "")
      ) ;_ end of progn
      (progn
        (setq y (atof str2))
        (setq str1 (substr str1 (1+ i)))
        (setq z (atof str1))
      ) ;_ end of progn
    ) ;_ end of if
  ) ;_ end of progn
     ) ;_ end of if
   ) ;_ end of repeat
 ) ;_ end of repeat
 (setq pt (list x y z))
) ;_ end of get-pt

(defun make-3dpolyline (ptlist)
 (entmake (list '(0 . "POLYLINE")
      '(100 . "AcDbEntity")
      '(100 . "AcDb3dPolyline")
      '(70 . 8)
     ) ;_ list
 ) ;_ entmake
 (repeat (length ptlist)
   (setq pt    (car ptlist)
    ptlist (cdr ptlist)
   ) ;_ setq
   (entmake (list '(0 . "VERTEX")
        '(100 . "AcDb3dPolylineVertex")
        (cons 10 pt)
        '(70 . 32)
       ) ;_ list
   ) ;_ entmake
 ) ;_ repeat
 (entmake '((0 . "SEQEND")))
) ;_ make-3dpolyline

(defun c:pl3 ()
 (setting)
 (poly3D)
 (resetting)
 (princ)
) ;_ c:pl3

(prompt "Enter PL3 to start")
;;;
;;;End Copy Here;;;

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.