Butch Posted November 5, 2009 Author Share Posted November 5, 2009 mdbdesign has a point here. Autocad uses lenght dimesion of 3.45 m but writes at dimesnion a value of 3,45! decimal comma and period! Quote Link to comment Share on other sites More sharing options...
Butch Posted November 5, 2009 Author Share Posted November 5, 2009 I tried changing dimesion style (decimal separator) from comma to point, but it doesnt work also :-( Quote Link to comment Share on other sites More sharing options...
fixo Posted November 5, 2009 Share Posted November 5, 2009 Oleg, can dimension data be extracted to excel in fraction format??? Hi bro I never worked with fraction in Excel so I have no clue ~'J'~ Quote Link to comment Share on other sites More sharing options...
fixo Posted November 5, 2009 Share Posted November 5, 2009 I tried changing dimesion style (decimal separator) from comma to point, but it doesnt work also :-( How about this: (vlax-put-property xcel "NumberFormat" (vlax-make-variant "0,00" ;<-- change on comma here ) ~'J'~ Quote Link to comment Share on other sites More sharing options...
Butch Posted November 5, 2009 Author Share Posted November 5, 2009 This is the difference: numbers over thousend are differently displayed Quote Link to comment Share on other sites More sharing options...
fixo Posted November 5, 2009 Share Posted November 5, 2009 This is the difference:numbers over thousend are differently displayed Sorry no more ideas in my dim brain ~'J'~ Quote Link to comment Share on other sites More sharing options...
Butch Posted November 5, 2009 Author Share Posted November 5, 2009 Fixo, its working! I think the problem was that we had different options in Excel for decimal commas and periods. Look at the pictures! This are youur settings, right? I made them like that and it works fine now :-) All this time my settings in Excel where other way around! Its ok now :-) Thanx a lot! Now we must have a lisp for measuring area of an closed polyline. Thats a must! Quote Link to comment Share on other sites More sharing options...
fixo Posted November 5, 2009 Share Posted November 5, 2009 Fixo, its working! I think the problem was that we had different options in Excel for decimal commas and periods. Look at the pictures! This are youur settings, right? I made them like that and it works fine now :-) All this time my settings in Excel where other way around! Its ok now :-) Thanx a lot! Now we must have a lisp for measuring area of an closed polyline. Thats a must! Main Got! It's so easy Shame on my head Cheers ~'J'~ Quote Link to comment Share on other sites More sharing options...
fixo Posted November 5, 2009 Share Posted November 5, 2009 Oleg, can dimension data be extracted to excel in fraction format??? Marek, This one works with fractions for me Let me know.. ~'J'~ DimsToXL_Frac.LSP Quote Link to comment Share on other sites More sharing options...
mdbdesign Posted November 6, 2009 Share Posted November 6, 2009 Oleg it is working but rounding to 1/4 instead of 1/16. Where I can change this option? Quote Link to comment Share on other sites More sharing options...
fixo Posted November 6, 2009 Share Posted November 6, 2009 Oleg it is working but rounding to 1/4 instead of 1/16. Where I can change this option? Hi Marek Not sure about imperials, you know we use just metric in my village Guess you need to change this line: (rtos (cdr row_data) 4 2) on (rtos (cdr row_data) 4 3)' or maybe on this one: (rtos (cdr row_data) 3 3)' play around yourself ~'J'~ Quote Link to comment Share on other sites More sharing options...
mdbdesign Posted November 6, 2009 Share Posted November 6, 2009 Got it: (rtos (cdr row_data) 4 4) Thank you brother! Quote Link to comment Share on other sites More sharing options...
fixo Posted November 6, 2009 Share Posted November 6, 2009 Got it:(rtos (cdr row_data) 4 4) Thank you brother! My greets to all of you ~'J'~ Quote Link to comment Share on other sites More sharing options...
rooban27 Posted December 4, 2009 Share Posted December 4, 2009 Any body can help me to get the area of any object directl to excel sheet? It means, How to get the Object area directly to excel sheet? Is there any Lisp program for this? If any body has,please help me. Thank you. Quote Link to comment Share on other sites More sharing options...
fixo Posted December 4, 2009 Share Posted December 4, 2009 Any body can help me to get the area of any object directl to excel sheet? It means, How to get the Object area directly to excel sheet? Is there any Lisp program for this? If any body has,please help me. Thank you. Take a look at this thread: http://www.cadtutor.net/forum/showthread.php?t=41722 ~'J'~ Quote Link to comment Share on other sites More sharing options...
TwistedE Posted April 26, 2010 Share Posted April 26, 2010 Sorry to bring this thread back from the dead but I had a few questions that are still unanswered after the 4 pages of detailed posts here which I am very thankful for. My knowledge in lisp > Next to nothing. I can load it and run it. I am fluent in vba but lisp is just a total doozy for some reason. Is there a way I can run fixo's program but instead of it exporting to it's own excel file(Importdims.xls) , can it ask me for the excel file to export to. I need it to export to Cell B2, C2 always in the file that I need which is already existing and I have some forumlas and template like thing setup. The reason is that I have an autocad file with a simple L shaped (always) object (side view, thickness of .25") and I want to export the L and W into my choice of Excel file. Then I will have that Excel file perform pre-written formulas upon those extracted dimensions and create a few more numbers which will be thrown back into the autocad file as an OLE object. So my autocad file should have an OLE data table from Excel like this: Var L W 001 10 5 002 10.25 5.25 ] 003 10.50 5.50 ] 004 10.75 5.75 ] Quote Link to comment Share on other sites More sharing options...
fixo Posted April 26, 2010 Share Posted April 26, 2010 Sorry to bring this thread back from the dead but I had a few questions that are still unanswered after the 4 pages of detailed posts here which I am very thankful for. My knowledge in lisp > Next to nothing. I can load it and run it. I am fluent in vba but lisp is just a total doozy for some reason. Is there a way I can run fixo's program but instead of it exporting to it's own excel file(Importdims.xls) , can it ask me for the excel file to export to. I need it to export to Cell B2, C2 always in the file that I need which is already existing and I have some forumlas and template like thing setup. The reason is that I have an autocad file with a simple L shaped (always) object (side view, thickness of .25") and I want to export the L and W into my choice of Excel file. Then I will have that Excel file perform pre-written formulas upon those extracted dimensions and create a few more numbers which will be thrown back into the autocad file as an OLE object. So my autocad file should have an OLE data table from Excel like this: Var L W 001 10 5 002 10.25 5.25 ] 003 10.50 5.50 ] 004 10.75 5.75 ] Sorry, not clearly enough for my Confirm, please: - you need VBA code only - you need to run it from AutoCAD - you want select in AutoCAD 2 dimensions and then always send them into B2, C2 cells in the tab "Sheet1" - all of the cell values need to be cleaned before - cell A2 values is still always equal to 001 - you want select .xls file from FileDialog window instead of using the default file name - then you will recalculte other cells in Excel file manually and will reexport Excel table back (manually too) Think would be better yet to post an example of Excel file and sample drawing and I could be start working something out And also right now I'm kinda busy a little, so I can't to help you quickly I use MS Office 2007/ Acad 2008 only (both english version) ~'J'~ Quote Link to comment Share on other sites More sharing options...
TwistedE Posted April 26, 2010 Share Posted April 26, 2010 -It can be VBA or LISP, I can run either one. I have run quite a few lisps today and yesterday trying to figure this problem out so I'm familiar with the process atleast. -Yes, I think it has to be run from AutoCAD.....maybe it's better run from Excel...not too sure .....the sample will clarify everything. -Yes, directly to Cell B2 and C2....B3, C3, B4,C4 have formulas that work based on B2 and C2. -Cell A2 is always equal to 001....have a look at the sample and the OLE Excel object table I have inserted in there. -I would like to select the excel file from the dialog window but I would basically like it to go into the excel file that is giving the OLE table in the Sample file. Please take your time, I don't want to rush you or anyone. It's just that there are hundreds of these files and by making these templates, I can really make my designs a lot faster where I only have to change the dimension and everything else happens automatically. Thanks again. Sample.dwg Quote Link to comment Share on other sites More sharing options...
fixo Posted April 26, 2010 Share Posted April 26, 2010 Got it Will try ~'J'~ Quote Link to comment Share on other sites More sharing options...
fixo Posted April 26, 2010 Share Posted April 26, 2010 -It can be VBA or LISP, I can run either one. I have run quite a few lisps today and yesterday trying to figure this problem out so I'm familiar with the process atleast.-Yes, I think it has to be run from AutoCAD.....maybe it's better run from Excel...not too sure .....the sample will clarify everything. -Yes, directly to Cell B2 and C2....B3, C3, B4,C4 have formulas that work based on B2 and C2. -Cell A2 is always equal to 001....have a look at the sample and the OLE Excel object table I have inserted in there. -I would like to select the excel file from the dialog window but I would basically like it to go into the excel file that is giving the OLE table in the Sample file. Please take your time, I don't want to rush you or anyone. It's just that there are hundreds of these files and by making these templates, I can really make my designs a lot faster where I only have to change the dimension and everything else happens automatically. Thanks again. Grabbed from other authors Change sheet name to suit '' require reference to Microsoft Excel XX.X Object Library Option Explicit Public Declare Function GetOpenFileName Lib "comdlg32.dll" _ Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long Public Type OPENFILENAME lStructSize As Long hwndOwner As Long hInstance As Long lpstrFilter As String lpstrCustomFilter As String nMaxCustFilter As Long nFilterIndex As Long lpstrFile As String nMaxFile As Long lpstrFileTitle As String nMaxFileTitle As Long lpstrInitialDir As String lpstrTitle As String flags As Long nFileOffset As Integer nFileExtension As Integer lpstrDefExt As String lCustData As Long lpfnHook As Long lpTemplateName As String End Type '@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@ ' Display and use the File open dialog '@~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@ Public Function ShowOpen() As String Dim strTemp As String Dim VertName As OPENFILENAME VertName.lStructSize = Len(VertName) VertName.hwndOwner = ThisDrawing.HWND VertName.lpstrFilter = "All Excel Files (*.xls)" + Chr$(0) + _ "*.xls" + Chr$(0) + " | " + "Excel Files (*.xlsx)" + Chr$(0) + _ "*.xlsx" VertName.lpstrFile = Space$(254) VertName.nMaxFile = 255 VertName.lpstrFileTitle = Space$(254) VertName.nMaxFileTitle = 255 VertName.lpstrInitialDir = CurDir VertName.lpstrTitle = "Select Excel File" VertName.flags = 0 If GetOpenFileName(VertName) Then strTemp = (Trim(VertName.lpstrFile)) ShowOpen = Mid(strTemp, 1, Len(strTemp) - 1) End If End Function '' Modified 10/8/03 to remove early binding and '' include late binding. Now should work with '' any version Excel Function IsExcelRunning() As Boolean Dim objXL As Object On Error Resume Next Set objXL = GetObject(, "Excel.Application") IsExcelRunning = (Err.Number = 0) Set objXL = Nothing Err.Clear End Function '' based on macros written by Jeff Mishler 'Changed the way Excel is loaded per suggestion by 'Randall Rath - [url]http://www.vbdesign.net/[/url] 'which also added the "Function IsExcelRunning" Public Sub ExportDims() Dim oEnt As AcadEntity Dim oDim As AcadDimRotated Dim oOle As AcadOle Dim mea1 As Double Dim mea2 As Double Dim pickPt As Variant ThisDrawing.Utility.GetEntity oEnt, pickPt, vbCrLf & "Select length dimension >> " If Not TypeOf oEnt Is AcadDimension Then Exit Sub Set oDim = oEnt mea1 = oDim.Measurement ThisDrawing.Utility.GetEntity oEnt, pickPt, vbCrLf & "Select width dimension >> " If Not TypeOf oEnt Is AcadDimension Then Exit Sub Set oDim = oEnt mea2 = oDim.Measurement ThisDrawing.Utility.GetEntity oEnt, pickPt, vbCrLf & "Select embedded table >> " If Not TypeOf oEnt Is AcadOle Then Exit Sub Set oOle = oEnt Dim xlFileName As String '***Begin code from Randall Rath****** Dim oXL As Object Dim blnXLRunning As Boolean blnXLRunning = IsExcelRunning() If blnXLRunning Then Set oXL = GetObject(, "Excel.Application") Else Set oXL = CreateObject("Excel.Application") oXL.Visible = False oXL.UserControl = False oXL.DisplayAlerts = False End If '***End code from Randall Rath****** Dim oWb As Object Dim oWs As Object xlFileName = ShowOpen() Set oWb = oXL.Workbooks.Open(xlFileName) If oWb Is Nothing Then MsgBox "The Excel file " & xlFileName & " not found" & _ "Try again." GoTo Exit_Here End If Set oWs = oWb.Worksheets("Sheet1") oWs.Activate ' write data to Excel oWs.Columns(1).NumberFormat = "@" oWs.Columns(2).NumberFormat = "0.00" oWs.Columns(3).NumberFormat = "0.00" oWs.Cells(2, 1) = "-001" oWs.Cells(2, 2) = mea1 oWs.Cells(2, 3) = mea2 oWs.Columns.AutoFit Exit_Here: Set oWs = Nothing oWb.Save: oWb.Close Set oWb = Nothing oXL.Quit Set oXL = Nothing DoEvents MsgBox "Done" End Sub ~'J'~ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.