Your Products have been synced, click here to refresh
MEAS_X, 0 -> center of the circle MEAS_X, 1 -> center of point 1 MEAS_X, 2 -> center of point 2 (and so on) mX1 = PCDCommand.GetText(MEAS_X, 1) mY1 = PCDCommand.GetText(MEAS_Y, 1) mZ1 = PCDCommand.GetText(MEAS_Z, 1) mX2 = PCDCommand.GetText(MEAS_X, 2) mY2 = PCDCommand.GetText(MEAS_Y, 2) mZ2 = PCDCommand.GetText(MEAS_Z, 2)
[...] ' Dim Something Dim iPointCount As Integer Dim iCount As Integer Dim dVectorX, dVectorY, dVectorZ As Double Dim dRadius As Double Dim dMax, dMin, dRound As Double ' Center from Cirle CirCenterX = PCDCommand.GetText(MEAS_X, 0) CirCenterY = PCDCommand.GetText(MEAS_Y, 0) CirCenterZ = PCDCommand.GetText(MEAS_Z, 0) iPointCount = PCDCommand.GetText(N_HITS, 0) ' each Point For iCount = 1 To iPointCount ' Vector "CIR1.HIT[1..CIR1.NUMHITS].XYZ-CIR1.XYZ" dVectorX = PCDCommand.GetText(MEAS_X, iCount) - CirCenterX dVectorY = PCDCommand.GetText(MEAS_Y, iCount) - CirCenterY dVectorZ = PCDCommand.GetText(MEAS_Z, iCount) - CirCenterZ ' Radius from each point "SQRT(DOT())" dRadius = Sqr((dVectorX * dVectorX) + (dVectorY * dVectorY) + (dVectorZ * dVectorZ)) ' remember max min "MAX(V1)" If iCount = 1 Then dMax = dRadius dMin = dRadius End If If dMax < dRadius Then dMax = dRadius If dMin > dRadius Then dMin = dRadius Next iCount ' result "ROUNDNESS=MAX(V1)-MIN(V1)" dRound = dMax - dMin [...]
For iCount = 1 To iPointCount ' Vector "CIR1.HIT[1..CIR1.NUMHITS].XYZ-CIR1.XYZ" dVectorX = DmisCommand.GetText(MEAS_X, iCount) - CirCenterX dVectorY = DmisCommand.GetText(MEAS_Y, iCount) - CirCenterY dVectorZ = DmisCommand.GetText(MEAS_Z, iCount) - CirCenterZ MsgBox dVectorX & " " & dVectorY & " " & dVectorZ
DIM LOC1= LOCATIE VAN CIRKEL CIR1 EENHEDEN=MM ,$ GRAFIEK=UIT TEKST=UIT MULT=10.00 PIJLDICHTHEID=100 OUTPUT=BEIDE HALVE HOEK=NEE AS NOM +TOL -TOL METG AFW BUITOL RN 0.000 0.050 0.000 0.009 0.009 0.000 -#------- EINDE VAN DIMENSIELOC1
Dim DmisApp As Object Dim DmisPart As Object Dim DmisCommands As Object Dim DmisCommand As Object Dim FCmd As Object Sub Main(OutputFileNameAndPath) Set DmisApp = CreateObject("PCDLRN.Application") Set DmisPart = DmisApp.ActivePartProgram Set DmisCommands = DmisPart.Commands CommandCount = DmisCommands.Count Set DmisCommand = DmisCommands.Item(CommandCount) Open OutputFileNameAndPath For Output As #1 For Each DmisCommand In DmisCommands If DmisCommand.IsFeature Then If DmisCommand.Type = 612 Or DmisCommand =202 Then' (612 = auto circle, 202 = measured circle. Using the numeric reference rather than text makes it language independent) Set FCmd = DmisCommand.FeatureCommand Print #1, DmisCommand.Id & chr(44) & FCmd.GetFormError() End If End If Next DmisCommand Close #1 End Sub
CS1 =SCRIPT/FILENAME= C:\USERS\PUBLIC\DOCUMENTS\SCRIPTS\GET_ROUNDNESS_FROM_FEATURE.BAS FUNCTION/Main,SHOW=YES,ARG1="C:\Users\Public\Documents\Scripts\Roundness_Output.txt",, STARTSCRIPT/ ENDSCRIPT/
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |