Jump to content

Specific dimension extraction to Excel


joesatch11

Recommended Posts

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!

Elevations.dwg

Excel output.JPG

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

; 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)

GetExcel.lsp

elwidht.xlsx

Edited by BIGAL
Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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

Edited by BIGAL
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...