sublim21 Posted July 19, 2010 Posted July 19, 2010 hey guys, my question is basically this, lets say i have an excel cell whose value i want to use as the text of a dimension that i've used text override, How do i do that? So for example, i have line that is currently dimensioned. The dimension call out is using the text override feature and it's currently labeled "Fs = 4in". In my excel spreadsheet, cell A1 has the value 8, how do i make the text in the autocad now say "Fs = 8in"? Thanks in advance for helping me with my problem Looking forward to pestering you guys with questions and learning more about autocad in general. -Pete Quote
BIGAL Posted July 20, 2010 Posted July 20, 2010 The correct way to do this to have your drawing object defined parametricly that way if you change the value in excel your object will change to reflect the true length and siplay a true dimension. Ask around but their is an old example called "SHAFT" about autocad version R12 change excel value drawing changes. Its not a good idea to just change a text value the drawing object should always be a true indication of what something looks like. A better way is to look at drawing the object based on your excel input. In saying that what are you drawing paste image etc here. Having used other software that uses the user input method for data and then draws it for you is the way to go. An example is "struc-plus" structual software it draws eveything with limited use of blocks, you could not compete with it seconds v's minutes. Quote
sublim21 Posted July 20, 2010 Author Posted July 20, 2010 appreciate bigal, i've tried looking for the demo you posted in your post and have been unable to find it, perhaps you can provide a link or more information about the demo. The primary use of the autocad drawings is to show the location, label, and magnitude of forces acting upon members. Having the drawing be scaled correctly is a secondary concern. Appreciate the help, hopefully someone knows how to do this. -Pete Quote
khoshravan Posted July 20, 2010 Posted July 20, 2010 appreciate bigal, The primary use of the autocad drawings is to show the location, label, and magnitude of forces acting upon members. Having the drawing be scaled correctly is a secondary concern. -Pete Primary usage of AutoCad is drawing to scale as Bigal stated. I don't think AutoCad is a good choose for thepurpose you are intended in. If I were you, I would use MicroSoft Visio for that purpose. BTW, what is the meaning of "text override". Do you mean to change the value of a text/number in a dimension line? Quote
sublim21 Posted July 20, 2010 Author Posted July 20, 2010 It's the most applicable program i have available at work. It also tends to be available in every engineering office. Visio does not have the same market penetration. so any ideas on how i can get this done? as always, appreciate the help guys, -Pete Quote
rkent Posted July 20, 2010 Posted July 20, 2010 Maybe this will help. http://lynn.blogs.com/lynn_allens_blog/2010/07/an-autocad-video-tip-on-linking-excel-with-autocad-tables.html Quote
BIGAL Posted July 21, 2010 Posted July 21, 2010 You can have an excel with values in it and update block attribute values in your drawing You just need a column reference = name of the attribute length width height 3 4 5 In the dwg a block or blocks would have an attribute = length, height, width. I dont use this but search here for "excel" there are lots and they do have examples & code of how to use excel to update blocks. Bit of luck soemone will read this and give you the post. Quote
10west Posted July 26, 2010 Posted July 26, 2010 So for example, i have line that is currently dimensioned. The dimension call out is using the text override feature and it's currently labeled "Fs = 4in". In my excel spreadsheet, cell A1 has the value 8, how do i make the text in the autocad now say "Fs = 8in"? This example would simply check the Excel activeworkbook sheet1 for the value in cell A1, and load that value into a variable which can be passed to the AutoCAD drawing. I can't off the top of my head, remember how to change an overridden value or set it, but you probably have that so you just pass that variable to AutoCAD from the Excel function. "Fs = " & newVal & "in" ===================A Naked Excel Cell Value to AutoCAD - VB connection Private Sub CommandXL1_Click() Dim AutoCAD As acadapplication Dim Thisdrawing As AcadDocument 'as Object Dim activedocument As Object Dim SSET2 As Object Dim ent As AcadEntity 'as Object Dim Excel As Object Dim excelSheet As Object Dim application As Object Dim newVal As String Dim newValtoAcad As String 'On Error Resume Next Set Excel = GetObject(, "Excel.Application") If Err <> 0 Then Err.Clear Set Excel = CreateObject("Excel.Application") If Err <> 0 Then MsgBox "Could not load Excel.", vbExclamation End End If End If Set excelSheet = Excel.ActiveWorkbook.Sheets("Sheet1") Set acadapp = GetObject(, "autocad.application") Set Thisdrawing = acadapp.activedocument Set SSET2 = Thisdrawing.SelectionSets.Add(str(Timer)) SSET2.SelectOnScreen R = 1 'YOU'LL HAVE TO EXPERIMENT HERE For Each ent In SSET2 newVal = excelSheet.Cells(R, 1).Value newValtoAcad = "Fs = " & newVal & "in" Next ent End Sub ============================= Another alternative that has some real hack possibilities is to correlate an Excel Named Range with an AutoCAD Group name, then you can peruse Excel names and get their values, and logically select the same "name" by using the named selection set in AutoCAD, it's "Group Name". ============Extracted for Example For x = 1 To Excel.application.Names.count 'see in context below excname = Excel.application.Names(x).Name strgroup = Trim(UCase(excname)) Set SSET2 = Thisdrawing.Groups.Item(strgroup) Set objGroups = Thisdrawing.Groups If UCase(objGroup.Name) = strgroup Then DoEvents Thisdrawing.Groups.Item(strgroup).Item(0).TextString = Excel.application.Range(excname).Value Thisdrawing.Groups.Item(strgroup).Item(0).Highlight True End If Next ============In a Routine with Excel Named Range and AutoCAD Group Name Private Sub CommandXL2_Click() On Error Resume Next Dim AutoCAD As acadapplication Dim Thisdrawing As AcadDocument Dim activedocument As Object Dim SSET2 As Object Dim Excel As Object Dim excelSheet As Object Dim application As Object Dim strgroup As String Set Excel = GetObject(, "Excel.Application") 'connect to open excel session If Err <> 0 Then Err.Clear Set Excel = CreateObject("Excel.Application") 'open an excel application session (if you know it's going to be available, delete this) If Err <> 0 Then MsgBox "Could not load Excel.", vbExclamation End End If End If ''On Error Resume Next Set acadapp = GetObject(, "autocad.application") 'connect to AutoCAD app Set Thisdrawing = acadapp.activedocument DoEvents For x = 1 To Excel.application.Names.count 'cycle through names in Excel excname = Excel.application.Names(x).Name 'Set excel name to a var strgroup = Trim(UCase(excname)) 'set var to correlate to acad group name, set to upper case for a consistent pattern, all upper, no case sensitivity Set SSET2 = Thisdrawing.Groups.Item(strgroup) 'relate the excname, to it's correlated acad group name, and select by that name Set objGroups = Thisdrawing.Groups 'set acad groups obj If UCase(objGroup.Name) = strgroup Then DoEvents Excel.application.Range(excname).Value = UCase(Thisdrawing.Groups.Item(excname).Item(0).TextString) 'set excel value from acad 'the below flips the data transfer UCase(Thisdrawing.Groups.Item(excname).Item(0).TextString) = Excel.application.Range(excname).Value 'set acad value from excel End If Next End Sub Quote
Asad Saeed Posted December 8, 2010 Posted December 8, 2010 How can i control dimension by Excel? pls tell me I'm not expert in AutoCAD. Quote
ReMark Posted December 8, 2010 Posted December 8, 2010 Asad: Welcome to the CADTutor forum. Maybe what you need is Jeffery P. Sanders lisp program called XL - Excel to AutoCAD v3.1 which describes this way.... "XL -This program allows you to send the information you have saved in Excel to an AutoCAD drawing. You can have the program draw a chart, replace text values, or replace attribute values." The program, along with a more detail explanation and screen shots too can be found here: http://www.jefferypsanders.com/autolisp_XL.html Quote
Asad Saeed Posted December 9, 2010 Posted December 9, 2010 @ ReMark: I want to control AutoCAD values by Excel, the software you mantion it just change the value once, and there is no any update feature! (as fer as my knowledge) @ 10west: How and where I've tu apply these codes? Quote
ReMark Posted December 9, 2010 Posted December 9, 2010 Then you are looking for a type of parametric control right? Quote
Asad Saeed Posted December 9, 2010 Posted December 9, 2010 do you have any idea??? pls reply me I've very urgent project.. Thanks in advanced T & R Asad Quote
ReMark Posted December 9, 2010 Posted December 9, 2010 do you have any idea??? pls reply me I've very urgent project.. Thanks in advanced T & R Asad Calm down. Like everyone else here I'm a volunteer. I don't get paid to answer questions. Understand? Some answers do not come quickly. Patience is still a virtue. Quote
ReMark Posted December 9, 2010 Posted December 9, 2010 (edited) Yeah, we're cool. I'm not having much luck at the moment and I must head out to the field to take some measurements. Upon my return I'll try again but I make no promises. The best I can do at the moment is this... http://rbytes.net/software/autopara-for-autocad-review/ For reference: Parametrics - Driven Drawings written by Bill Kramer, July, 2003 for Cadalyst magazine. http://www.cadalyst.com/cad/autocad/parametrics-driven-drawings-4799 My last words on the subject of parametric design. Depending on how intent you are to go this way I feel you have but two options: 1) upgrade to AutoCAD 2011 which has a parametric feature or 2) for truely parametric design make the switch to Inventor instead. Using any other option of older AutoCAD programs (like 2008) and add-ons or custom programming is just going to bog you down. Good luck. The end. Edited December 9, 2010 by ReMark Quote
samuraxt Posted April 28, 2012 Posted April 28, 2012 Hi 10west, I tried your above program in excel vba. but am not getting the thing done. The declarations like "Dim AutoCAD As acadapplication Dim Thisdrawing As AcadDocument Dim activedocument As Object" are not being accepted by excel vba. Is there anything wrong in the way i use it? - samuraxt Quote
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.