Hello everybody,
I have a quick question about the WorldPositionMatrix of created parts. I always set the WorldPosition of the parts in the vcmx-files that I use for my Component Creators at (0/0/0). After the parts have been created in my project I grab them with a robot or transport them via one way paths. I create new parts of the same vcmx-file every 2 seconds, but I only want to change the colour of some at a specific position. I work with this code to get the position:
from vcScript import * import vcMatrix app = getApplication() comp = getComponent() weldingCreator = comp.getBehaviour("ComponentCreator3") weldingContainer = comp.getBehaviour("ComponentContainer2") def OnRun(): while True: #default colour when weldingSignal false if(weldingSignal.Value == False): comp1 = app.findComponent("Welding part-1.2") comp2 = app.findComponent("Welding part-2.4") if comp1.getFeature("Welding part-1.2"): geo_feat1 = comp1.getFeature("Welding part-1.2") geo_cont1 = geo_feat1.Geometry colour = app.findMaterial('metal') #paint all created Welding parts-1.2 for set in geo_cont1.GeometrySets: set.Material = colour geo_feat1.rebuild() app.render() ................................................................................................................................................... #paint created Welding parts-1.2 at (100/100/100) for set in geo_cont1.GeometrySets: print 'Node Position:' print geo_feat1.NodePositionMatrix.P.X, geo_feat1.NodePositionMatrix.P.Y, geo_feat1.NodePositionMatrix.P.Z print 'Comp Position:' print comp1.WorldPositionMatrix.P.X, comp1.WorldPositionMatrix.P.Y, comp1.WorldPositionMatrix.P.Z if( ********position that i need******** == (100/100/100)): set.Material = colour geo_feat1.rebuild() app.render() ................................................................................................................................................... if comp2.getFeature("Welding part-2.4"): geo_feat2 = comp2.getFeature("Welding part-2.4") geo_cont2 = geo_feat2.Geometry colour = app.findMaterial('metal') for set in geo_cont2.GeometrySets: set.Material = colour geo_feat2.rebuild() app.render() ...
I always get the result (0/0/0). The parts are moved in the world but I’m still getting the WorldPosition of the part in the origin vcmx-file. How do I get the position of the moved parts? I really appreciate your help, thanks a lot