How to use getSystemObject method in pyatom

Best Python code snippet using pyatom_python

ConstraintSystem.py

Source:ConstraintSystem.py Github

copy

Full Screen

...42 obj.addProperty("App::PropertyPythonObject", "System_Data")43 obj.Proxy = self44 App.ActiveDocument.Constraints.addObject(obj)45 @staticmethod46 def getSystemObject():47 """48 Returns the system object inside this assembly49 """50 systemObject = App.ActiveDocument.getObject(ConstraintSystem.name)51 if systemObject:52 return systemObject53 else:54 print("No system object in assembly")55 @staticmethod56 def updateSystem():57 system = ConstraintSystem.getSystemObject()58 if system is None:59 return60 systemGraph = nx.MultiGraph()61 for f in App.ActiveDocument.Constraints.Group:62 if f.Name == ConstraintSystem.name:63 continue64 u = None65 v = None66 label = f.Name67 weight = f.reduced_DoF68 constraintData = f.Parameters69 constraintType = f.Type70 if f.Type == "Lock_Constraint":71 u = f.Object72 v = "LOCK_NODE"73 systemGraph.add_edge(u, v, weight=weight, label=label,74 parameters=constraintData,75 constraintType=constraintType)76 system.System_Data = nx.to_dict_of_dicts(systemGraph)77 # ConstraintSystem.addLinkedObject()78 # @staticmethod79 # def addLinkedObject():80 # """81 # Adds a node representing the linked objects that have datums82 # constrained in the assembly83 # """84 # system = ConstraintSystem.getSystemObject()85 # if system is None:86 # return87 # systemGraph = nx.from_dict_of_dicts(system.System_Data,88 # multigraph_input=True,89 # create_using=nx.MultiGraph)90 # for v in list(systemGraph.nodes()):91 # if "." in v:92 # parentName, datumName = v.split(".")93 # if parentName not in systemGraph.nodes():94 # label = "Fix_Constraint_" + v95 # constraintType = "Virtual_Fix_Constraint"96 # components = FixComponents(parentName, v)97 # systemGraph.add_edge(v, parentName, weight=6,98 # components=components, label=label,99 # constraintType=constraintType)100 # system.System_Data = nx.to_dict_of_dicts(systemGraph)101 @staticmethod102 def getObjects():103 """104 Returns a dictionary containing all the names of all objects in the105 system with their position and rotation values106 """107 system = ConstraintSystem.getSystemObject()108 if system is None:109 return110 systemGraph = nx.from_dict_of_dicts(system.System_Data)111 objects = {}112 for objName in systemGraph.nodes:113 if objName == "LOCK_NODE":114 continue115 objects[objName] = {}116 objects[objName]["x"] = getBaseVal(objName, "x")117 objects[objName]["y"] = getBaseVal(objName, "y")118 objects[objName]["z"] = getBaseVal(objName, "z")119 objects[objName]["phi"] = getRotationVal(objName, "x")120 objects[objName]["theta"] = getRotationVal(objName, "y")121 objects[objName]["psi"] = getRotationVal(objName, "z")122 return objects123 @staticmethod124 def getConstraintNames():125 """126 Returns a dictionary containing all the names of of the constraints in127 the system and the respective objects they constraint128 """129 system = ConstraintSystem.getSystemObject()130 if system is None:131 return132 systemGraph = nx.from_dict_of_dicts(system.System_Data,133 multigraph_input=True,134 create_using=nx.MultiGraph)135 constraintNames = {}136 for obj1Name, obj2Name, data in systemGraph.edges(data=True):137 if data["constraintType"] == "Lock_Constraint":138 fName = data["label"]139 objName = None140 if obj1Name == "LOCK_NODE":141 objName = obj2Name142 else:143 objName = obj1Name144 constraintNames[fName] = {"Object": objName}145 return constraintNames146 @staticmethod147 def getConstraintParameters():148 """149 Returns a dictionary containing all the parameters of the constraints150 in the system.151 """152 system = ConstraintSystem.getSystemObject()153 if system is None:154 return155 systemGraph = nx.from_dict_of_dicts(system.System_Data,156 multigraph_input=True,157 create_using=nx.MultiGraph)158 constraintParameters = {}159 for _, _, data in systemGraph.edges(data=True):160 if data["constraintType"] == "Lock_Constraint":161 fName = data["label"]162 constraintParameters[fName] = data["parameters"]...

Full Screen

Full Screen

getSiteStatus.py

Source:getSiteStatus.py Github

copy

Full Screen

...23 retval = {}24 # If the directory is initialized and system object is configured properly, call it.25 if hasattr(self.gLeonardo, 'directory') :26 if hasattr(self.gLeonardo.directory, 'getSystemObject') :27 sysObj = self.gLeonardo.directory.getSystemObject()28 # If the alarm manager is initialized.29 if hasattr(self.gLeonardo.directory, 'getSystemObject') and \30 hasattr(self.gLeonardo.directory.getAlarmManager(), 'getAlarmStatus') :31 retval = dict(sysObj.getSiteInfo().items() + self.gLeonardo.directory.getAlarmManager().getAlarmStatus().items())32 retval["timeInfo"] = sysObj.getCurrentTime()33 retval["alarmChimeSnoozeTimeRemaining"] = int( self.gLeonardo.directory.getAlarmManager().getAlarmChimeSnoozeTimeRemaining() )34 retval["alarmChimeSnoozeEnable"] = self.gLeonardo.directory.getAlarmManager().getAlarmChimeSnoozeEnable()35 retval["strTestEmailMsg"] = self.gLeonardo.directory.getAlarmManager().getTestEmailMsg()36 except Exception, e:37 log.exception("*** getSiteStatus Exception: " + str(e))38 retval = {}...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful