CATIA VB.net create chanfer by selected face - vb.net

I'm trying to create a chamfer using pre selected faces in a macro. But i'm no having much sucess
what I have tried:
The faces are previously selected.
chamfer2 = shapeFactory1.AddNewChamfer(reference1, catTangencyChamfer, catLengthAngleChamfer, catNoReverseChamfer, 1, 45.0#)
Dim Num_Faces As Integer = selection1.count
Dim Faces_ref(Num_Faces)
For i = 1 To Num_Faces
Dim MyBRepName = (selection1.Item(i).Value.Name)
MyBRepName = Replace(MyBRepName, "Selection_", "")
MyBRepName = Left(MyBRepName, InStrRev(MyBRepName, "));"))
MyBRepName = MyBRepName + ");WithPermanentBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)"
MsgBox(MyBRepName)
reference1 = Part1.CreateReferenceFromName(MyBRepName)
chamfer1.AddElementToChamfer(reference1)
Next
the error appears here:
chamfer1.AddElementToChamfer(reference1)

Try to remove brackets from reference1 like this:
chamfer1.AddElementToChamfer reference1

Related

Libreoffice Unable to fill ListBox because I could not declare the listbox righteously

I have a Listbox in my Calc Worksheet and I am trying to address it for filling it with data
DialogLibraries.LoadLibrary("Standard")
oDialog = CreateUnoDialog(DialogLibraries.Standard)
listBoxGruppe = oEvent.Source.Context.getControl("Drop_Down_5") 'oDialog.getControl("Drop_Down_5")
aItems = sheetb.getCellRangeByName(subStrRan).dataarray
Dim sItems(ubound(aItems))
For i = 0 To ubound(aItems)
sItems(i) = aItems(i)(0)
Next i
listBoxGruppe.addItems(sItems, 0)
oDialog.Execute()
However, it seems u need to call a certain Dialog, but idk what is the name of my Dialog for this scenario - this is how my code behind looks like
I think you don't need dialogs at this situation
dim RangeAddr as new com.sun.star.table.CellRangeAddress
RangeAddr.EndColumn = 1
RangeAddr.EndRow = Cell.CellAddress.Row
RangeAddr.Sheet = 2
RangeAddr.StartColumn = 1
RangeAddr.StartRow = 0
dim initParam(0) as new com.sun.star.beans.NamedValue
initParam(0).Name="CellRange"
initParam(0).Value = RangeAddr
CellRangeListSource = doc.createInstanceWithArguments("com.sun.star.table.CellRangeListSource", initParam )
listBoxGruppe.setListEntrySource CellRangeListSource

Create Heatmap and ContourSeries with Oxyplot

I’m trying to display data from csv file as a combination of contour and heat maps. CSV file consists of three columns:
x;y;z
1;1;1
2;1;1
3;1;2
4;1;2
5;1;2
6;1;2
7;1;2
8;1;1
9;1;1
10;1;1
1;2;1
2;2;1
3;2;2
4;2;4
5;2;4
Etc…
After reading csv I convert it to arrays and use them as data source for OxyPlot HeatMapSeries and ContourSeries according t examples I was able to find. Unfortunately, they are only in C#. Hope, someone can help with VB. So far, I created below listing, however result does not represent the data I have in csv.
Dim dt_table As DataTable = csvToDatatable_2(Application.StartupPath & "\test.csv", ";")
Dim x(dt_table.Rows.Count - 1) As Double
Dim y(dt_table.Rows.Count - 1) As Double
Dim numbers(dt_table.Rows.Count - 1, 2) As Double
For i = 0 To dt_table.Rows.Count - 1
x(i) = CDbl(dt_table.Rows(i)(0))
y(i) = CDbl(dt_table.Rows(i)(1))
numbers(i, 0) = CDbl(dt_table.Rows(i)(0))
numbers(i, 1) = CDbl(dt_table.Rows(i)(1))
numbers(i, 2) = CDbl(dt_table.Rows(i)(2))
Next
Dim Plotmodel As New OxyPlot.PlotModel
Dim linearColorAxis As New OxyPlot.Axes.LinearColorAxis()
linearColorAxis.Palette = OxyPalettes.Rainbow(10)
Plotmodel.Axes.Add(linearColorAxis)
Dim heatmapseries1 As New OxyPlot.Series.HeatMapSeries
heatmapseries1.X0 = 0
heatmapseries1.X1 = 10
heatmapseries1.Y0 = 0
heatmapseries1.Y1 = 10
heatmapseries1.Interpolate = True
heatmapseries1.Data = numbers
Dim contourSeries1 As New OxyPlot.Series.ContourSeries()
contourSeries1.LineStyle = LineStyle.Solid
contourSeries1.StrokeThickness = 2
contourSeries1.ContourColors = {OxyColors.Aquamarine, OxyColors.Aqua, OxyColors.CadetBlue, OxyColors.Blue, OxyColors.Black, OxyColors.Red}
contourSeries1.RowCoordinates = x
contourSeries1.ColumnCoordinates = y
contourSeries1.Data = numbers
Plotmodel.Series.Add(heatmapseries1)
Plotmodel.Series.Add(contourSeries1)
PlotView1.Model = Plotmodel
Even shape of Contourseries is not square, as expected:

The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)

I've a problem when I run simple add-on into SAP Business One. I've gotten this exception through this snippet of this code :
' After changing the item quantity
If (pVal.ItemUID = "mat") And (pVal.ColUID = "ActQuan") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_VALIDATE) Then
Dim oEditPrice As SAPbouiCOM.EditText ' Item Price
Dim oEditTDTotal As SAPbouiCOM.EditText ' To Date Total
Dim oEditTDQuan As SAPbouiCOM.EditText ' To Date Quan
Dim oEditCuttings As SAPbouiCOM.EditText ' Cuttings
Dim oEditTotal As SAPbouiCOM.EditText ' Total = TDTotal - Cuttings
Dim oEditActQuan As SAPbouiCOM.EditText
' Get the items from the matrix
oEditPrice = colItemPrice.Cells.Item(pVal.Row).Specific
oEditTDTotal = colItemTDTotal.Cells.Item(pVal.Row).Specific
oEditTDQuan = colItemTDQuan.Cells.Item(pVal.Row).Specific
oEditTotal = colItemACuttings.Cells.Item(pVal.Row).Specific
oEditCuttings = colItemCuttings.Cells.Item(pVal.Row).Specific
oEditActQuan = colItemActQuan.Cells.Item(pVal.Row).Specific
' Copy the value of TDQty
Dim tmpInt As Integer
tmpInt = CInt(oEditActQuan.Value)
oEditTDQuan.Value = CInt(tmpInt)
' Copy the value of TDTotal
Dim tmpIn As Integer
tmpIn = CInt(oEditTDQuan.Value) * CInt(oEditPrice.Value)
oEditTDTotal.Value = CInt(tmpIn)
'Calc Total Row - ACuts
Dim tmpTotal As Integer ' temp variable to contain total result
tmpTotal = CInt(oEditTDTotal.Value) - CInt(oEditCuttings.Value)
oEditTotal.Value = CInt(tmpTotal)
' Calc the document total
Dim CalcTotal As Double
Dim i As Integer
CalcTotal = 0
' Iterate all the matrix rows
For i = 1 To oMatrix.RowCount
oEditTotal = colItemACuttings.Cells.Item(i).Specific
CalcTotal += oEditTotal.Value
Next
oDocTotal.Value = CalcTotal
End If
End If
End If
I use VB.Net. I have an issue with ColUID = "ActQuan" . Can anyone help me ?
I changed this column many times and the same error.
Not the exact same thing, but in sap, we get this RPC_E_SERVERFAULT issue when sap scripting settings are not correct. The following changes worked for me:
Open transaction RZ11
Set the following to true:
sapgui/user_scripting
Set the following to false:
sapgui/nwbc_scripting
sapgui/user_scripting_disable_recording
sapgui/user_scripting_force_notification
sapgui/user_scripting_per_user
sapgui/user_scripting_set_readonly
Enable user side scripting.
More detailed documentation can be found here.

Retrieve texte from a Masters

I'm working on Visio 2013 for a project and I'm new to VBA and Visio.
First, I wrote a function which imports a CSV file in the current visio document by creating first a string table texte of the CSV and then adding it in a shape:
Dim sp As Visio.Shape
Set sp = ActiveDocument.Pages(1).Drop(Visio.ActiveDocument.Masters("Puce 120"), 4, 10)
sp.Characters.Text = texte
Now I want to write the reverse function, from the shape to a CSV file but I can't find a way to access the text in my shape "Puce 120".
I wrote this:
Dim vsoMasters As Visio.Masters
Dim intMasterCount As Integer
Dim intCounter As Integer
Dim vsoMaster As Visio.Master
Set vsoMasters = ActiveDocument.Masters
intMasterCount = vsoMasters.Count
If intMasterCount > 0 Then
For intCounter = 1 To intMasterCount
If vsoMasters.Item(intCounter).Name = "Puce 120" Then
Set vsoMaster = vsoMasters.Item(intCounter)
End If
Next intCounter
Else
Debug.Print " No masters in document"
End If
Dim shap As Visio.Shapes
Set shap = vsoMaster.Shapes
Dim ch As Visio.Characters
ch = shap.Characters
But I don't find my text in ch. Can someone explain me how to retrieve it?
You can put and get text of a shape using shape.Text property.
Is there any reason for all other fancy stuff? That is, you can set shape text like this:
shape.Text = "Hello"
And get it back like this:
myText = shape.Text

Cant figure out how to merge variables vb.net

I am creating a for each loop to take the words from a string and place them each into a text box. The program allows for up to "9" variables What I am trying to attempt is.
Foreach word in Words
i = i +1
Varible & i = word
txtCritical1.Text = variable & i
any ideas on a way to make this work?
Have a look through the MSDN article on For Each. It includes a sample using strings.
https://msdn.microsoft.com/en-us/library/5ebk1751.aspx
So i went with a simple if statement this does the trick. Each text box is filled in.
Dim details As String = EditEvent.EditDbTable.Rows(0).Item(13).ToString()
Dim words As String() = details.Split(New Char() {"«"})
Dim word As String
For Each word In words
i = i + 1
v = word
If i = 1 Then
txtCritical1.Text = v
ElseIf i = 2 Then
txtCritical2.Text = v
ElseIf ....
ElseIf i = 9 then
txtCritical2.text = v
Else
....
End If
Next