Results 1 to 4 of 4

Thread: Autocad distance measurement to excel

  1. #1
    Login to Give a bone
    0

    Default Autocad distance measurement to excel

    Hi everyone,

    i am new to autolisp. apologies if i mention stupid things. i work as a quantity surveyor in building projects. We mostly get autocad drawings from consultants and prepare quantities spreadsheets. I wonder if i have a routine which can directly export data from autocad to excel.

    The routine should ask for options (what you want to export) i.e. distance, length, area or text. once we make a choice it will ask for appropriate selection. For example, for distance it will ask select first point then second point. In third step it may ask for "Specify column range in excel" i.e. A,B,C etc. (I assume that file name and sheet name are predefined. plz guide me on this)

    On execution of command, it will find non empty cell in specified workbook and puts the value.

    i know i won't get cake on this but bread will be fine. i also checked getexcel.lsp. But, it lacks the functionality i need. i am ready to learn autolisp. Suggest me some good resources to achieve my objective.

    thank you

    virendra

  2. #2
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Re: Autocad distance measurement to excel

    Hey Virendra, welcome to the forum.

    I have had the same need in the past and have found a simple work around to be, to write the information to text files and use a simple vba macro to read and write into excel.
    There are a lot of great resources for reading and writing to text files in both lisp and VBA.
    It might prove to be an easier approach than interfacing directly with excel from lisp.
    It also has the benefit of keeping your autocad routine quick.
    Hope this helps.

  3. #3
    Login to Give a bone
    0

    Default Re: Autocad distance measurement to excel

    Hi LSElite,

    Thanks a lot for the reply. as u said i googled it. but couldnt get appropriate resources. importantly, distance measurement export. i.e. u select two points and distance between them exported to text file or excel. or else, can u direct me to your resources??

    thanks again

    virendra

  4. #4
    I could stop if I wanted to
    Join Date
    2012-11
    Location
    Brisbane, Australia
    Posts
    239
    Login to Give a bone
    0

    Default Re: Autocad distance measurement to excel

    No worries mate.
    I would first get the 2 points from the user
    Code:
    (setq p1 (getpoint "Select First Point: "))
    (setq p2 (getpoint "Select Second Point: "))
    Then you would get the distance between the 2 points.
    Code:
    (setq dist (distance p1 p2))
    Then you need this write the distance out to a text file.
    Here are some handy resources for text file handling:
    http://www.jefferypsanders.com/autolispintr_rw.html
    http://www.afralisp.net/autolisp/tut...e-handling.php

    That will get you half way the next step would then be to read it from a macro in excel.
    Here is a reference which should help:
    http://www.excel-easy.com/vba/exampl...text-file.html

    If you need any more help let me know.
    If you want I can give you a few more tips when you get to the VBA macro.

Similar Threads

  1. Replies: 5
    Last Post: 2013-10-16, 05:39 PM
  2. Replies: 1
    Last Post: 2012-08-08, 05:50 PM
  3. Replies: 1
    Last Post: 2009-04-29, 11:03 AM
  4. Distance command in Paperspace, returns Modelspace distance.
    By chuck_cantieny in forum AutoCAD General
    Replies: 4
    Last Post: 2006-09-21, 04:00 PM
  5. Distance AutoCAD course learning
    By ndousm in forum Training
    Replies: 9
    Last Post: 2006-03-08, 12:21 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
  •