def showSpline(graphS, graph, xyz): import upy helper = upy.getHelperClass()() segments = getSegments(graphS, graph) a = 0 for s in segments: if len(s) > 1: helper.spline("test_" + str(a), xyz[s]) a += 1
def get_ePMV(): """ Retrieve the embeded PMV session. @rtype: object @return: the current ePMV session """ import upy uiclass = upy.getUIClass() hclass = upy.getHelperClass() #epmv = None #c4d use the current document name epmv = uiclass._restore('mv','epmv') if epmv is None : dname = hclass.getCurrentSceneName() epmv = uiclass._restore('mv',dname) return epmv
def get_ePMV(): """ Retrieve the embeded PMV session. @rtype: object @return: the current ePMV session """ import upy uiclass = upy.getUIClass() hclass = upy.getHelperClass() #epmv = None #c4d use the current document name epmv = uiclass._restore('mv', 'epmv') if epmv is None: dname = hclass.getCurrentSceneName() epmv = uiclass._restore('mv', dname) return epmv
sys.path.append( "C:\Users\ludov\AppData\Roaming\MAXON\CINEMA 4D R17 Demo_E0A949BC\plugins\ePMV\mgl64\MGLToolsPckgs\PIL" ) sys.path.append( "C:\Users\ludov\AppData\Roaming\MAXON\CINEMA 4D R17 Demo_E0A949BC\plugins\ePMV\mgl64\MGLToolsPckgs\lib-tk" ) NOGUI = 1 import autopack from autopack.Environment import Environment from autopack import IOutils as io helper = autopack.helper if helper is None and not NOGUI: import upy helperClass = upy.getHelperClass() helper = helperClass() else: import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper recipe = "D:\\Data\\cellPACK_data\\cellPACK_database_1.1.0\\recipes\\HIV_VLP.1.1.json" #127 filename = recipe #"/Users/ludo/DEV/autopack_git/autoPACK_database_1.0.0/recipes/NM_Analysis_FigureA1.0.xml" fileName, fileExtension = os.path.splitext(filename) n = os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe = n h.loadRecipe(filename) #recenter ingredient position according center.
@author: - """ #example for a script not a plugin .... import sys,os #pyubic have to be in the pythonpath, if not add it pathtoupy = "/Users/ludo/DEV/" sys.path.insert(0,pathtoupy) import upy upy.setUIClass() from upy import uiadaptor #get the CGhelper helperClass = upy.getHelperClass() class template(uiadaptor): def setup(self): self.w = 200 #define all the widget we want self.initWidget(id=10) #setup the layout organisation of the define widget self.setupLayout() #is it a subwindow self.subdialog = Flase #theses two function are for c4d and shouldnt be changed def CreateLayout(self):
def setup(self,**kw): self.title = "SphereTreeMaker" #we need the helper if "helper" in kw: self.helper = kw["helper"] else : self.helper = upy.getHelperClass()() self.sc = self.helper.getCurrentScene() self.dock = False if "subdialog" in kw : if kw["subdialog"]: self.subdialog = True self.block = True self.points = [] self.seeds = [] self.seedsCoords = [] self.object_target_name = "ObjectName" self.object_target = self.helper.getCurrentSelection()[0] if self.object_target is not None : self.object_target_name = self.helper.getName(self.object_target) self.sphere = self.helper.getObject('Sphere') if self.sphere is None : self.sphere = self.helper.newEmpty('Sphere') self.helper.addObjectToScene(self.sc,self.sphere) self.baseSphere = self.helper.getObject('baseSphere') if self.baseSphere is None : self.baseSphere = self.helper.Sphere('baseSphere',parent=self.sphere)[0] self.principal_axes = (1,0,0) self.principal_axes_cylinder = None self.clusterCenterSpheres=[] self.clusterSpheres=[] self.clusterCenterCyl={} self.root_cluster = self.helper.getObject('Cluster') if self.root_cluster is None : self.root_cluster = self.helper.newEmpty("Cluster") self.helper.addObjectToScene(self.sc,self.root_cluster) self.Spheres = self.helper.getObject('Spheres') if self.Spheres is None : self.Spheres=self.helper.newEmpty("Spheres") self.helper.addObjectToScene(self.sc,self.Spheres,parent =self.root_cluster) self.CenterSpheres = self.helper.getObject('CenterSpheres') if self.CenterSpheres is None : self.CenterSpheres=self.helper.newEmpty("CenterSpheres") self.helper.addObjectToScene(self.sc,self.CenterSpheres,parent =self.root_cluster) self.keptCenters = [] self.keptRadii = [] self.factor = 0.5 self.clusters = None self.initWidget(id=1005) self.setupLayout() self.isSetup = True self.io = IOingredientTool() self.ingr = None self.setTarget()
along with ePMV. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>. """ ############################################################################# # # Author: Ludovic Autin # # Copyright: Ludovic Autin TSRI 2010 # # ############################################################################# import sys import os #from ePMV.epmvAdaptor import epmvAdaptor import upy maxHelper = upy.getHelperClass() #from upy.autodesk3dsmax.v2015 import maxHelper print("helper is ", maxHelper) from ePMV.lightGridCommands import addGridCommand from ePMV.lightGridCommands import readAnyGrid from ePMV.lightGridCommands import IsocontourCommand from Pmv.mvCommand import MVCommand from Pmv.moleculeViewer import MoleculeViewer from Pmv.moleculeViewer import DeleteGeomsEvent, AddGeomsEvent, EditGeomsEvent from Pmv.moleculeViewer import DeleteAtomsEvent, EditAtomsEvent from Pmv.deleteCommands import BeforeDeleteMoleculesEvent, AfterDeleteAtomsEvent from Pmv.displayCommands import BindGeomToMolecularFragment from Pmv.trajectoryCommands import PlayTrajectoryCommand
boundaries=[0]+bounds+[13], extend='both', ticks=bounds, # optional spacing='proportional', orientation='vertical') cb2.set_label('Discrete intervals, some other units') # Make the PNG canvas = FigureCanvasAgg(fig) # The size * the dpi gives the final image size # a4"x4" image * 80 dpi ==> 320x320 pixel image filename = "/Users/ludo/mw_v_xlogp_ellipses.png" canvas.print_figure(filename, dpi=dpi) import DejaVu DejaVu.enableVBO = False from DejaVu import Viewer vi = Viewer() filename = "/Users/ludo/mw_v_xlogp_ellipses.png" figsize = (3,8) dpi = 80 import upy helper = upy.getHelperClass()(master=vi) plane = helper.plane("plotplane",center=[0.,0.,0.], size=[dpi*figsize[0]/10.,dpi*figsize[1]/10.], subdivision=(1,1),axis="+Z")#-Z c4d, Z maya mat = helper.createTexturedMaterial("plot",filename) helper.assignMaterial(plane,mat,texture=True)
# -*- coding: utf-8 -*- """ Created on Tue Jun 13 09:43:18 2017 @author: ludov """ #with given recipe open, show one ingredient sphereTree + PDB import c4d env = c4d.af.values()[0].histoVol.values()[0] name = "mpn529" #HU ingr = env.getIngrFromName(name) pdb = ingr.source["pdb"] # load in pmv ? sphTree_coords = ingr.positions sphTree_radii = ingr.radii #build points clouds import upy helper = upy.getHelperClass()() helper.PointCloudObject("sph" + name, vertices=sphTree_coords[0])
def setup(self, **kw): self.title = "SphereTreeMaker" #we need the helper if "helper" in kw: self.helper = kw["helper"] else: self.helper = upy.getHelperClass()() self.sc = self.helper.getCurrentScene() self.dock = False if "subdialog" in kw: if kw["subdialog"]: self.subdialog = True self.block = True self.points = [] self.seeds = [] self.seedsCoords = [] self.object_target_name = "ObjectName" self.object_target = self.helper.getCurrentSelection()[0] if self.object_target is not None: self.object_target_name = self.helper.getName(self.object_target) self.sphere = self.helper.getObject('Sphere') if self.sphere is None: self.sphere = self.helper.newEmpty('Sphere') self.helper.addObjectToScene(self.sc, self.sphere) self.baseSphere = self.helper.getObject('baseSphere') if self.baseSphere is None: self.baseSphere = self.helper.Sphere('baseSphere', parent=self.sphere)[0] self.principal_axes = (1, 0, 0) self.principal_axes_cylinder = None self.clusterCenterSpheres = [] self.clusterSpheres = [] self.clusterCenterCyl = {} self.root_cluster = self.helper.getObject('Cluster') if self.root_cluster is None: self.root_cluster = self.helper.newEmpty("Cluster") self.helper.addObjectToScene(self.sc, self.root_cluster) self.Spheres = self.helper.getObject('Spheres') if self.Spheres is None: self.Spheres = self.helper.newEmpty("Spheres") self.helper.addObjectToScene(self.sc, self.Spheres, parent=self.root_cluster) self.CenterSpheres = self.helper.getObject('CenterSpheres') if self.CenterSpheres is None: self.CenterSpheres = self.helper.newEmpty("CenterSpheres") self.helper.addObjectToScene(self.sc, self.CenterSpheres, parent=self.root_cluster) self.keptCenters = [] self.keptRadii = [] self.factor = 0.5 self.clusters = None self.initWidget(id=1005) self.setupLayout() self.isSetup = True self.io = IOingredientTool() self.ingr = None self.setTarget()
along with ePMV. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>. """ ############################################################################# # # Author: Ludovic Autin # # Copyright: Ludovic Autin TSRI 2010 # # ############################################################################# import sys import os #from ePMV.epmvAdaptor import epmvAdaptor import upy maxHelper = upy.getHelperClass() #from upy.autodesk3dsmax.v2015 import maxHelper print ("helper is ",maxHelper) from ePMV.lightGridCommands import addGridCommand from ePMV.lightGridCommands import readAnyGrid from ePMV.lightGridCommands import IsocontourCommand from Pmv.mvCommand import MVCommand from Pmv.moleculeViewer import MoleculeViewer from Pmv.moleculeViewer import DeleteGeomsEvent, AddGeomsEvent, EditGeomsEvent from Pmv.moleculeViewer import DeleteAtomsEvent, EditAtomsEvent from Pmv.deleteCommands import BeforeDeleteMoleculesEvent,AfterDeleteAtomsEvent from Pmv.displayCommands import BindGeomToMolecularFragment from Pmv.trajectoryCommands import PlayTrajectoryCommand
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with ePMV. If not, see <http://www.gnu.org/licenses/gpl-3.0.html>. """ ############################################################################# # # Author: Ludovic Autin # # Copyright: Ludovic Autin TSRI 2010 # # ############################################################################# import upy c4dHelper = upy.getHelperClass() from ePMV.epmvAdaptor import epmvAdaptor import c4d from MolKit.protein import Protein,Chain from Pmv.pmvPalettes import AtomElements #from Pmv.pmvPalettes import DavidGoodsell, DavidGoodsellSortedKeys #from Pmv.pmvPalettes import RasmolAmino, RasmolAminoSortedKeys #from Pmv.pmvPalettes import Shapely #from Pmv.pmvPalettes import SecondaryStructureType class c4dAdaptor(epmvAdaptor): """ The specific adaptor for C4D R12.
import upy import math import numpy from numpy import linalg as LA from random import random helper=upy.getHelperClass()() def angle(v1,v2): return numpy.arccos(numpy.dot(v1,v2)/(LA.norm(v1)*LA.norm(v2))) def distance(a,b): d = numpy.array(a) - numpy.array(b) s = numpy.sum(d*d) return s #def segmentCross(A,B,C,D): # #xrange ? # I1 = [min(A[0],B[0]), max(A[0],B[0])] # I2 = [min(C[0],D[0]), max(C[0],D[0])] # Ia = [max( min(A[0],B[0]), min(C[0],D[0]) ), min( max(A[0],B[0]), max(C[0],D[0])] )] # if (max(A[0],B[0]) < min(C[0],D[0])) # return False; # return numpy.dot(v1,v2) def segmentCross(A,B,C,D): #are they parrallele AB=A-B CD=C-D a=angle(AB,CD) # print a,math.degrees(a) if a == math.pi or a == math.pi * 2 : #parrallele
def __init__(self, initSize, helper=None): # init the octree's root cube at the world origin self.root = self.addNode([0, 0, 0], initSize, []) self.helper = helper if self.helper is None: self.helper = upy.getHelperClass()()
# specify two extra boundaries: boundaries=[0] + bounds + [13], extend='both', ticks=bounds, # optional spacing='proportional', orientation='vertical') cb2.set_label('Discrete intervals, some other units') # Make the PNG canvas = FigureCanvasAgg(fig) # The size * the dpi gives the final image size # a4"x4" image * 80 dpi ==> 320x320 pixel image filename = "/Users/ludo/mw_v_xlogp_ellipses.png" canvas.print_figure(filename, dpi=dpi) import DejaVu DejaVu.enableVBO = False from DejaVu import Viewer vi = Viewer() filename = "/Users/ludo/mw_v_xlogp_ellipses.png" figsize = (3, 8) dpi = 80 import upy helper = upy.getHelperClass()(master=vi) plane = helper.plane("plotplane", center=[0., 0., 0.], size=[dpi * figsize[0] / 10., dpi * figsize[1] / 10.], subdivision=(1, 1), axis="+Z") #-Z c4d, Z maya mat = helper.createTexturedMaterial("plot", filename) helper.assignMaterial(plane, mat, texture=True)
def showGraph(graph, xyz): import upy helper = upy.getHelperClass()() nodes = np.array(graph.node.keys(), int) faces = makeFaceFromEdge(graph) test = helper.createsNmesh("tesT", xyz[nodes], None, faces)