Dear Sirs,
I need to stract data of Quantity Survey of all the structure from Robot. I need something similar to attached image. I have found out "Irobotstructurequantity" variable, but I do not know how to use it. Could you give me the code to extract it into excel from VB.net??
Thank you in advance, regards
Solved! Go to Solution.
Solved by Rafal.Gaweda. Go to Solution.
Example for Material and Bars survey:
Dim RobApp As New RobotApplication Dim Mat As RobotMaterialQuantitySurvey Dim MatLabel As RobotLabel Dim MatData As RobotMaterialData Row = 7 Set Mat = RobApp.Project.Structure.QuantitySurvey.Materials For i = 1 To Mat.Count Cells(Row, 1) = Mat.GetName(i) Set MatLabel = RobApp.Project.Structure.Labels.Get(I_LT_MATERIAL, Mat.GetName(i)) Set MatData = MatLabel.Data Cells(Row, 2) = MatData.E Cells(Row, 3) = MatData.Kirchoff Cells(Row, 4) = MatData.RO Cells(Row, 5) = MatData.NU Cells(Row, 6) = Mat.GetVolume(I_OT_BAR, i) Cells(Row, 7) = Mat.GetWeight(I_OT_BAR, i) Row = Row + 1 Next i Row = Row + 1 Dim BQ As RobotBarSectionQuantitySurvey Set BQ = RobApp.Project.Structure.QuantitySurvey.BarSections For i = 1 To BQ.Count Cells(Row + i, 1) = BQ.GetName(i) Cells(Row + i, 2) = BQ.GetLength(i) Cells(Row + i, 3) = BQ.GetWeight(i) Cells(Row + i, 4) = BQ.GetVolume(i) Row = Row + 1 Next i
or create table I_TT_MEASURE and save it as txt (=csv)
OK, it works..
thank you.
"or create table I_TT_MEASURE and save it as txt (=csv)" : could you give me a code example please...
Hello,
It's possible do a code to get the quantity survey only a selected bar or a group of bars?
Thank you.
Best regards,
By dumping filtered quantities table
Example:
Private Sub CommandButton1_Click() Dim RobApp As RobotApplication Set RobApp = New RobotApplication Dim t As RobotTable Dim tf As RobotTableFrame Dim path As String Dim Fullpath As String Dim FName As String path = Environ$("temp") Dim nTables As Long Set t = RobApp.Project.ViewMngr.CreateTable(I_TT_MEASURE, I_TDT_DEFAULT)
t.Select I_ST_BAR, "1 3to6" Set tf = RobApp.Project.ViewMngr.GetTable(1) FName = tf.Window.Caption spacepos = InStr(1, FName, " ") If spacepos <> 0 Then FName = Left(FName, spacepos - 1) + "_" End If tf.Get(1).Window.Activate Set t = tf.Get(1) tf.Current = 1 tabname = tf.GetName(1) tabname = Replace(tabname, " ", "_") DoEvents Fullpath = path + "\" + FName + tabname + ".txt" t.Printable.SaveToFile Fullpath, I_OFF_TEXT ansifilepath = Left(Fullpath, Len(Fullpath) - 4) + "_ansi.txt" X = Shell("cmd.exe /A /C TYPE " + Fullpath + " > " + ansifilepath, vbNormalFocus) DoEvents For Iii = 1 To 10000000 aaa = Iii Next Iii Workbooks.OpenText Filename:=ansifilepath, DataType:=xlDelimited, Semicolon:=True MsgBox "Dumping finished" Set RobApp = Nothing End Sub