Your Products have been synced, click here to refresh
Set PCDCommand = PCDCommands.Add (GENERIC_CONSTRUCTION, True) PCDCommand.Marked = True retval = PCDCommand.SetExpression ("0+0", THEO_X, 0) retval = PCDCommand.SetExpression ("0+" & DLG.CheckBox_1, THEO_Y, 0) retval = PCDCommand.SetExpression ("0+0", THEO_Z, 0) retval = PCDCommand.SetExpression ("0+0", THEO_I, 0) retval = PCDCommand.SetExpression ("0+0", THEO_J, 0) retval = PCDCommand.SetExpression ("0+1", THEO_K, 0) retval = PCDCommand.PutText (Diameter, THEO_DIAM, 0) retval = PCDCommand.SetExpression ("0+0", MEAS_X, 0) retval = PCDCommand.SetExpression ("0+" & DLG.CheckBox_1, MEAS_Y, 0) retval = PCDCommand.SetExpression ("0+0", MEAS_Z, 0) retval = PCDCommand.SetExpression ("0+0", MEAS_I, 0) retval = PCDCommand.SetExpression ("0+0", MEAS_J, 0) retval = PCDCommand.SetExpression ("0+1", MEAS_K, 0) retval = PCDCommand.PutText (Diameter, MEAS_DIAM, 0) retval = PCDCommand.PutText ("CDATA", ID, 0) retval = PCDCommand.SetToggleString (4, GEN_FEAT_TYPE, 0)
from win32com.client import Dispatch from win32com.client import gencache from win32com.client import constants gencache.EnsureModule('{2A09476D-B502-4089-AA46-452D6754CB33}', 0, 9, 1) DmisApp = Dispatch("pcdlrn.Application") DmisApp.Visible = 1 DmisAppEvents = DmisApp.ApplicationEvents DmisApp.WaitUntilReady(40) DmisPart = DmisApp.ActivePartProgram DmisCmds = DmisPart.Commands FeatureTypes = [ "Basic Hit", "CIRCLE (CONTACT)", "CONE (CONTACT)", "CYLINDER (CONTACT)", "Generic Feature", "LINE (CONTACT)", "Measured Circle", "Measured Cone", "Measured Cylinder", "Measured Line", "Measured Plane", "Measured Point", "Measured Round Slot", "Measured Sphere", "Measured Square Slot", "Measured Torus", "PLANE (CONTACT)", "SPHERE (CONTACT)", "VECTOR POINT (CONTACT)", ] DataTypes = [ constants.THEO_X, constants.THEO_Y, constants.THEO_Z, constants.THEO_SX, constants.THEO_SY, constants.THEO_SZ, constants.THEO_EX, constants.THEO_EY, constants.THEO_EZ, constants.THEO_R, constants.THEO_A, constants.THEO_H, constants.THEO_SR, constants.THEO_SA, constants.THEO_SH, constants.THEO_ER, constants.THEO_EA, constants.THEO_EH, constants.THEO_I, constants.THEO_J, constants.THEO_K, constants.TARG_X, constants.TARG_Y, constants.TARG_Z, constants.TARG_SX, constants.TARG_SY, constants.TARG_SZ, constants.TARG_EX, constants.TARG_EY, constants.TARG_EZ, constants.TARG_R, constants.TARG_A, constants.TARG_H, constants.TARG_SR, constants.TARG_SA, constants.TARG_SH, constants.TARG_ER, constants.TARG_EA, constants.TARG_EH, constants.TARG_I, constants.TARG_J, constants.TARG_K, constants.MEAS_X, constants.MEAS_Y, constants.MEAS_Z, constants.MEAS_SX, constants.MEAS_SY, constants.MEAS_SZ, constants.MEAS_EX, constants.MEAS_EY, constants.MEAS_EZ, constants.MEAS_R, constants.MEAS_A, constants.MEAS_H, constants.MEAS_SR, constants.MEAS_SA, constants.MEAS_SH, constants.MEAS_ER, constants.MEAS_EA, constants.MEAS_EH, constants.MEAS_I, constants.MEAS_J, constants.MEAS_K, ] for cmd in DmisCmds: if cmd.TypeDescription in FeatureTypes: for dtype in DataTypes: old = cmd.GetText(dtype, 0) cmd.SetExpression(old + "+0", dtype, 0)
from win32com.client import Dispatch from win32com.client import gencache from win32com.client import constants gencache.EnsureModule('{2A09476D-B502-4089-AA46-452D6754CB33}', 0, 9, 1) DmisApp = Dispatch("pcdlrn.Application") DmisApp.Visible = 1 DmisAppEvents = DmisApp.ApplicationEvents DmisApp.WaitUntilReady(40) DmisPart = DmisApp.ActivePartProgram DmisCmds = DmisPart.Commands FeatureTypes = [ "Basic Hit", "CIRCLE (CONTACT)", "CONE (CONTACT)", "CYLINDER (CONTACT)", "Generic Feature", "LINE (CONTACT)", "Measured Circle", "Measured Cone", "Measured Cylinder", "Measured Line", "Measured Plane", "Measured Point", "Measured Round Slot", "Measured Sphere", "Measured Square Slot", "Measured Torus", "PLANE (CONTACT)", "SPHERE (CONTACT)", "VECTOR POINT (CONTACT)", ] DataTypes = [ constants.THEO_X, constants.THEO_Y, constants.THEO_Z, constants.THEO_SX, constants.THEO_SY, constants.THEO_SZ, constants.THEO_EX, constants.THEO_EY, constants.THEO_EZ, constants.THEO_R, constants.THEO_A, constants.THEO_H, constants.THEO_SR, constants.THEO_SA, constants.THEO_SH, constants.THEO_ER, constants.THEO_EA, constants.THEO_EH, constants.THEO_I, constants.THEO_J, constants.THEO_K, constants.TARG_X, constants.TARG_Y, constants.TARG_Z, constants.TARG_SX, constants.TARG_SY, constants.TARG_SZ, constants.TARG_EX, constants.TARG_EY, constants.TARG_EZ, constants.TARG_R, constants.TARG_A, constants.TARG_H, constants.TARG_SR, constants.TARG_SA, constants.TARG_SH, constants.TARG_ER, constants.TARG_EA, constants.TARG_EH, constants.TARG_I, constants.TARG_J, constants.TARG_K, constants.MEAS_X, constants.MEAS_Y, constants.MEAS_Z, constants.MEAS_SX, constants.MEAS_SY, constants.MEAS_SZ, constants.MEAS_EX, constants.MEAS_EY, constants.MEAS_EZ, constants.MEAS_R, constants.MEAS_A, constants.MEAS_H, constants.MEAS_SR, constants.MEAS_SA, constants.MEAS_SH, constants.MEAS_ER, constants.MEAS_EA, constants.MEAS_EH, constants.MEAS_I, constants.MEAS_J, constants.MEAS_K, ] for cmd in DmisCmds: if cmd.TypeDescription in FeatureTypes: for dtype in DataTypes: old = cmd.GetText(dtype, 0) new = old[[emoticon:33306C418930400BAC28808410F8AC8B]ld.find("+0")] cmd.SetExpression(new, dtype, 0)
I can extract the THEO values, but they don’t seem to be in the correct coordinate
How'd you that? I could probably help but by the time I type up my solution someone will have posted a better one hahaha! But I'll go ahead and try to help out someone who is constantly sharing their knowledge with others, Mr. dph51.
Post your code if you don't mind. I'll guide you/correct it if needed.
Sub Main() Dim PCDApp, PCDPartPrograms, PCDPartProgram, PCDCommands, PCDCommand Set PCDApp = CreateObject("PCDLRN.Application") Set PCDPARTPROGRAMS = PCDApp.PartPrograms Set PCDPartProgram = PCDApp.ActivePartProgram Set PCDCommands = PCDPartProgram.Commands Dim cmd As Object Dim fcntr As Integer Dim FeatureList$(99999) Dim TX, TY, TZ, NewTX, NewTY, NewTZ As Variant fcntr = 0 For Each cmd in PCDCommands If cmd.IsDCCFeature or cmd.IsMeasuredFeature Then FeatureList(fcntr) = cmd.id MSG = "feature ID = " & FeatureList(fcntr) TX = cmd.GetText(THEO_X, 0) TY = cmd.GetText(THEO_Y, 0) TZ = cmd.GetText(THEO_Z, 0) NewTX = TX & "+0" NewTY = TY & "+0" NewTZ = TZ & "+0" 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 End If Next cmd Set PCDApp = nothing Set PCDPartPrograms = nothing Set PCDPartProgram = nothing
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |