Your Products have been synced, click here to refresh
You can use the code below to extract data from a command using the alignment you desire. It's .net, so you'll need to modify it for basic.
Sub MAIN() ' Post: http://www.pcdmisforum.com/forum/pc-dmis-enterprise-metrology-software/pc-dmis-code-samples/411735-vb-script-using-puttext-To-enter-an-expression Dim PCDApp As Object Dim PCDPartPrograms As Object Dim PCDPartProgram As Object Dim PCDCommands As Object Dim cmd As Object Dim editWin As Object Dim oTHEO As Object Set PCDApp = CreateObject("PCDLRN.Application") Set PCDPartPrograms = PCDApp.PartPrograms Set PCDPartProgram = PCDApp.ActivePartProgram Set PCDCommands = PCDPartProgram.Commands Set editWin = PCDPartProgram.EditWindow Dim fcntr As Integer Dim FeatureList$(99999) Dim TX, TY, TZ, NewTX, NewTY, NewTZ, txtBlock, alignID, txtBlockTmp, MSG As String Dim lastChr, findTHEO, findChr, firstComma, secondComma As Integer fcntr = 0 For Each cmd In PCDCommands If cmd.IsAlignment And cmd.ID <> "" Then alignID = cmd.ID End If If cmd.IsDCCFeature Or cmd.IsMeasuredFeature Then If cmd.Marked Then FeatureList(fcntr) = cmd.ID TX = CStr(cmd.FeatureCommand.GetHit(1, FHITDATA_CENTROID, FDATA_TARG, FDATA_PART, alignID, PLANE_TOP).X) TY = CStr(cmd.FeatureCommand.GetHit(1, FHITDATA_CENTROID, FDATA_TARG, FDATA_PART, alignID, PLANE_TOP).Y) TZ = CStr(cmd.FeatureCommand.GetHit(1, FHITDATA_CENTROID, FDATA_TARG, FDATA_PART, alignID, PLANE_TOP).Z) NewTX = TX & "+0" NewTY = TY & "+0" NewTZ = TZ & "+0" MSG = MSG & Chr(10) & Chr(10) & cmd.ID MSG = MSG & Chr(10) & Chr(10) & alignID MSG = MSG & Chr(10) & Chr(10) & "XTheo = " & TX MSG = MSG & Chr(10) & Chr(10) & "YTheo = " & TY MSG = MSG & Chr(10) & Chr(10) & "ZTheo = " & TZ MSG = MSG & Chr(10) & Chr(10) & "NewXTheo = " & NewTX MSG = MSG & Chr(10) & Chr(10) & "NewYTheo = " & NewTY MSG = MSG & Chr(10) & Chr(10) & "NewZTheo = " & NewTZ MsgBox MSG MSG = "" End If End If Next cmd Set PCDApp = Nothing Set PCDPartPrograms = Nothing Set PCDPartProgram = Nothing End Sub
You can use the code below to extract data from a command using the alignment you desire. It's .net, so you'll need to modify it for basic.
Sub MAIN() ' Post: http://www.pcdmisforum.com/forum/pc-dmis-enterprise-metrology-software/pc-dmis-code-samples/411735-vb-script-using-puttext-To-enter-an-expression Dim PCDApp As Object Dim PCDPartPrograms As Object Dim PCDPartProgram As Object Dim PCDCommands As Object Dim cmd As Object Dim editWin As Object Dim oTHEO As Object Set PCDApp = CreateObject("PCDLRN.Application") Set PCDPartPrograms = PCDApp.PartPrograms Set PCDPartProgram = PCDApp.ActivePartProgram Set PCDCommands = PCDPartProgram.Commands Set editWin = PCDPartProgram.EditWindow Dim fcntr As Integer Dim FeatureList$(99999) Dim TX, TY, TZ, NewTX, NewTY, NewTZ, txtBlock, alignID, txtBlockTmp, MSG As String Dim lastChr, findTHEO, findChr, firstComma, secondComma As Integer fcntr = 0 For Each cmd In PCDCommands If cmd.IsAlignment And cmd.ID <> "" Then alignID = cmd.ID End If If cmd.IsDCCFeature Or cmd.IsMeasuredFeature Then If cmd.Marked Then FeatureList(fcntr) = cmd.ID TX = CStr(cmd.FeatureCommand.GetHit(1, FHITDATA_CENTROID, FDATA_TARG, FDATA_PART, alignID, PLANE_TOP).X) TY = CStr(cmd.FeatureCommand.GetHit(1, FHITDATA_CENTROID, FDATA_TARG, FDATA_PART, alignID, PLANE_TOP).Y) TZ = CStr(cmd.FeatureCommand.GetHit(1, FHITDATA_CENTROID, FDATA_TARG, FDATA_PART, alignID, PLANE_TOP).Z) NewTX = TX & "+0" NewTY = TY & "+0" NewTZ = TZ & "+0" MSG = MSG & Chr(10) & Chr(10) & cmd.ID MSG = MSG & Chr(10) & Chr(10) & alignID MSG = MSG & Chr(10) & Chr(10) & "XTheo = " & TX MSG = MSG & Chr(10) & Chr(10) & "YTheo = " & TY MSG = MSG & Chr(10) & Chr(10) & "ZTheo = " & TZ MSG = MSG & Chr(10) & Chr(10) & "NewXTheo = " & NewTX MSG = MSG & Chr(10) & Chr(10) & "NewYTheo = " & NewTY MSG = MSG & Chr(10) & Chr(10) & "NewZTheo = " & NewTZ MsgBox MSG MSG = "" End If End If Next cmd Set PCDApp = Nothing Set PCDPartPrograms = Nothing Set PCDPartProgram = Nothing End Sub
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |