lgms
New member
- Sep 24, 2018
- 3
Hi Everyone!
I am trying to do multiple clash reports and create only one excel report. I have done almost everything, but I could not create the images of each clash (just like the xml file does when you export it) to my excel report.
Is there a function that automatic get an image like the clash preview or should I make a routine for the user to photograph the conflict the way they want it?
can anyone help me with that?
the part of the code where I run the clash and get the results is below
I am trying to do multiple clash reports and create only one excel report. I have done almost everything, but I could not create the images of each clash (just like the xml file does when you export it) to my excel report.
Is there a function that automatic get an image like the clash preview or should I make a routine for the user to photograph the conflict the way they want it?
can anyone help me with that?
the part of the code where I run the clash and get the results is below
Code:
Dim oFirstMechanism 'As Mechanism
oFirstMechanism = cTheMechanisms.Item(1)
Dim parameters2 As Parameters
parameters2 = product1.Parameters
Dim joints1 As Joints
joints1 = oFirstMechanism.Joints
Dim GearJoint As Joint
GearJoint = joints1.Item(4)
dValcmd(0) = 0
Dim i = 0
'3-Retrieve current command values
'*********************************
oFirstMechanism.GetCommandValues(dValcmd)
oFirstMechanism.Update()
Dim maxStep As Integer
Dim nStep As Integer
'configure nstep and maxstep
'*********************************************
Try
maxStep = TxtBoxMaxStep.Text
nStep = TxtBoxStep.Text
Catch ex As Exception
CloseExcel()
Return -1
End Try
Dim k As Integer = 1
For i = 0 To maxStep Step nStep
' 4.a-Create another command set
'*******************************
dValcmd(0) = i
' 4.b-Apply the command set
'**************************
oFirstMechanism.PutCommandValues(dValcmd)
If i = 0 Then oFirstMechanism.Update()
'Run Clash and get the Conflicts results
'*******************************************
oClash.Compute()
cConflicts = oClash.Conflicts
'Take clash conflicts values and export to excel
'*********************************************
xlApp.Visible = True
For j As Integer = 1 To cConflicts.Count
oConflict = cConflicts.Item(j)
If oConflict.Value < 0 Then
xlWorkSheet.Cells(k + 1, 1).Value = i
xlWorkSheet.Cells(k + 1, 2).Value = j
xlWorkSheet.Cells(k + 1, 3).Value = oConflict.FirstProduct.Name
xlWorkSheet.Cells(k + 1, 4).Value = oConflict.SecondProduct.Name
xlWorkSheet.Cells(k + 1, 5).Value = oConflict.Value
xlWorkSheet.Cells(k + 1, 6).Value = oConflict.Type
xlWorkSheet.Cells(k + 1, 7).Value = oConflict.Status
xlWorkSheet.Cells(k + 1, 8).Value = oConflict.Comment
k = k + 1
End If
Next
Next