+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2011
    Join Date
    Jul 2017
    Posts
    2

    Default Specific dimension extraction to Excel

    Registered forum members do not see this ad.

    Hello, I've seen threads of people with similar requests. I have a different issue, I need to extract only the dimensions noted as "F.S." in the attached DWG file for each individual window. the Excel file should look like the attached image. So the method used needs to recognize the window name (A, B) and list the dimensions for the respective window in the Excel file.
    Any help would be very appreciated!, thank you in advance!
    Attached Images
    Attached Files

  2. #2
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,727

    Default

    Looking at your dwg I would make the following comments, yes you can do pick 3 dims and write to excel, just me I would be looking more into the "A" block containing invisible attributes that come from the window frame dimensions much easier that way. Whilst I dont draw windows as a norm I would look also into dynamic blocks, again you click once and get all the info about that window.

    Putting front ends to this type of stuff saves so much time, answer the ten questions and splat all done.

    Its a big step but others here will probably agree you will never look back and production will increase. Bill T any comment ?

    Any way if some one else does not beat me I will try to do something for you.
    A man who never made mistakes never made anything

  3. #3
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,727

    Default

    I sort of got it to work as I work metric it would be perfect working feet adds a overhead, others may know a way around but it does add values to a spread sheet as you pick.

    Code:
    ; this will read various objects in the dwg
    ; its hard coded for a fileame for testing  change to pick file name
    ; using findfile etc
    ; it is hard coded for 3 picks
    ; picking dims returns the measurement so UNITS must be reset
    
    (defun objectis  (obj / )
    (setq objname (vla-get-objectName obj))
    (cond
    ((= objname "AcDbText")(setq txtstr (vla-get-textstring obj)))
    ;((= objname "AcDbMText")(stripmtxt))
    ((= objname "AcDbMText")(setq txtstr (vla-get-textstring obj)))
    ((= objname "AcDbRotatedDimension")(setq txtstr (rtos (vla-get-measurement obj)5 3)))
    )
    (if (= txtstr nil)(alert "object not supported"))
    )
    
    (defun stripmtxt ( / )
    (setq txtstr (vla-get-textstring obj))
    (setq txtstr (LM:UnFormat (txtstr T )))
    )
    
    
    
    (defun c:doentry ( / obj)
    (setq col 1)
    (repeat 3
    (setq obj (vlax-ename->vla-object (car (entsel "\nPick object"))))
    (setq row (+ maxrow# 1))
    (objectis obj)
    (setq txtstr (vl-string-subst "" "F.S." TxtStr))
    (alert txtstr)
    (PutCell (strcat (NUMBER2ALPHA COL) (rtos Row 2 0)) txtstr )
    (setq col (+ col 1))
    )
    (setq maxrow# (+ maxrow# 1))
    )
    
    (defun c:doclose ( / )
    (CLOSEEXCEL "C:\\temp\\elwidht.XLS")
    )
    
    )
    ;------------------------------------------------------------------------------------------------
    ; starts here 
    ;------------------------------------------------------------------------------------------------ 
    
    (if (not openexcel)(load "getexcel.lsp"))
    (if (not  LM:UnFormat)(load "Unformat-mtext-string"))
    
    ; hard coded for testing excel must exist
    (OpenExcel "C:\\Temp\\elwidht.xlsx" "Sheet1" t)
    
    ; need this to find max row col as exists
    (setq excelrc (VLAX-GET-PROPERTY *EXCELAPP%  'selection))
    ; only need to run once
    (SETQ MAXROW# (VLAx-GET-PROPERTY excelrc 'Row))
    (SETQ MAXCOLUMN# (VLAX-GET-PROPERTY excelrc 'column))
    
    ; start for 1st time when loading
    (c:doentry)
    Attached Files
    Last edited by BIGAL; 1st Aug 2017 at 11:21 am.
    A man who never made mistakes never made anything

  4. #4
    Forum Newbie
    Discipline
    Architectural
    Using
    AutoCAD 2011
    Join Date
    Jul 2017
    Posts
    2

    Default

    Thank you Bigal for your help, I see that you almost got it working, I'm not sure what to do after I upload the .LSP in my AutoCAD, but I did notice in the Excel file that the 29 3/8" dimension was listed under height, when it should've been the width. Also, remember that I only need to list the "F.S." dimensions (might make things easier).

  5. #5
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,727

    Default

    Registered forum members do not see this ad.

    The pick order is just pick 3 objects in the required order the FS does not count as the value returned is the measurement not text. I exploded the dim a couple of times to get the value as text during testing.

    The dim command does the auto convert of the "measurement" to feet & fraction inches. I figured it out need (rtos x 5 3) decimal inches plus fractions
    Last edited by BIGAL; 1st Aug 2017 at 11:24 am.
    A man who never made mistakes never made anything

Similar Threads

  1. AutoCAD Lisp Help: Attribute Extraction into Excel BOM
    By ml3428 in forum AutoLISP, Visual LISP & DCL
    Replies: 10
    Last Post: 19th Oct 2012, 02:46 am
  2. Autocad 2010, data extraction to excel
    By Lagviper in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 21st Sep 2011, 11:33 pm
  3. Attribute Extraction to Excel
    By 1badsti in forum AutoLISP, Visual LISP & DCL
    Replies: 1
    Last Post: 17th Aug 2010, 07:58 am
  4. dynamic block with attributes extraction to excel
    By Astro in forum AutoLISP, Visual LISP & DCL
    Replies: 15
    Last Post: 9th Dec 2009, 03:30 pm
  5. [Excel] Attribute Extraction
    By Moe` in forum AutoCAD General
    Replies: 4
    Last Post: 8th Jan 2009, 09:59 am

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts