示例#1
0
 def __SetMaterial(self):
     hObject = vs.LNewObj()
     if self.__fMaterial == LedgeMaterial.Wood:
         #vs.SetTextureRef(hObject, -1, 1)
         vs.SetFillBack(hObject, kColorIndexWood)
     elif self.__fMaterial == LedgeMaterial.Metal:
         #vs.SetTextureRef(hObject, -1, 2)
         vs.SetFillBack(hObject, kColorIndexMetal)
     else:
         #vs.SetTextureRef(hObject, -1, 3)
         vs.SetFillBack(hObject, kColorIndexPlastic)
示例#2
0
 def __set_not_by_clazz(self):
     """We'll just 'undo' by class by setting the attributes it had from the class."""
     vs.SetLSN(self.handle, vs.GetLSN(self.handle))
     vs.SetLW(self.handle, vs.GetLW(self.handle))
     vs.SetPenFore(self.handle, vs.GetPenFore(self.handle))
     vs.SetPenBack(self.handle, vs.GetPenBack(self.handle))
     vs.SetFillFore(self.handle, vs.GetFillFore(self.handle))
     vs.SetFillBack(self.handle, vs.GetFillBack(self.handle))
     vs.SetFPat(self.handle, vs.GetFPat(self.handle))
     vs.SetOpacity(self.handle, vs.GetOpacity(self.handle))
     ok, style, angle, size, width, thickness_basis, thickness, visibility = vs.GetObjBeginningMarker(
         self.handle)
     vs.SetObjBeginningMarker(self.handle, style, angle, size, width,
                              thickness_basis, thickness, visibility)
     ok, style, angle, size, width, thickness_basis, thickness, visibility = vs.GetObjEndMarker(
         self.handle)
     vs.SetObjEndMarker(self.handle, style, angle, size, width,
                        thickness_basis, thickness, visibility)
示例#3
0
def Reset():
    width = vs.PWidth
    height = vs.PHeight
    elevation = vs.PElvInWall
    angle = vs.POpeningAngle
    leafType = vs.GetRField(gObjHandle, gObjName, 'Leaf')
    isOpened = vs.GetRField(gObjHandle, gObjName, 'OpenTheWindow')
    wallType = vs.GetTypeN(gWallHandle)

    if (wallType == 68 or wallType == 89):
        thickness = vs.WallWidth(gWallHandle)
    else:
        upi = vs.GetPrefReal(152) / 25.4
        thickness = 100 * upi

    if isOpened == "False":
        angle = 0

    frameObj = frame.Frame(width, height, thickness, elevation, leafType,
                           angle)
    frameObj.Draw()

    #draw curtain#######################

    if vs.PHasCurts:
        objLedge = Ledge.LedgeObj(height / 20, height / 40, width,
                                  height + elevation, vs.PLedgeMaterial,
                                  vs.PLedgeType, thickness)
        objLedge.DrawLedge()

        hObject = vs.LNewObj()
        if objLedge.getMaterial() == "Wood":
            #if self.__fMaterial == LedgeMaterial.Wood:
            vs.SetFillBack(hObject, Constants.kColorIndexWood)
        elif objLedge.getMaterial() == "Metal":
            #elif self.__fMaterial == LedgeMaterial.Metal:
            vs.SetFillBack(hObject, Constants.kColorIndexMetal)
        else:
            vs.SetFillBack(hObject, Constants.kColorIndexPlastic)

        curtainPieces = int(
            vs.Str2Num(vs.GetRField(gObjHandle, gObjName, "Pieces")))
        curtainStartZ = elevation + thickness / 2
        curtainStartY = thickness / 2 - objLedge.getLedgeShaftWidth(
        ) * 1.5 + objLedge.getLedgeWidth()
        curtainHeight = objLedge.getLedgeHeight(
        ) - objLedge.getLedgeShaftHeight()
        curtainWidth = width * Ledge.kLedgeOutWindow

        curtainCurvesWidth = 2
        if curtainCurvesWidth > objLedge.getLedgeShaftWidth():
            curtainCurvesWidth = objLedge.getLedgeShaftWidth()

        curtainOpacity = int(
            vs.Str2Num(vs.GetRField(gObjHandle, gObjName, 'Opacity')))
        distanceBetweenCurtainPieces = 30
        curtainCurveStep = 30
        curtainColor = vs.Str2Num(
            vs.GetRField(gObjHandle, gObjName, '__CustomColor'))
        # distanceBetweenCurtainPieces, curtainCurveStep and curtainCurveWidth are not neccessary to add in the creation of the object
        curtain = Curtain(Vector(0, -curtainStartY,
                                 curtainStartZ), curtainWidth, curtainHeight,
                          curtainColor, curtainPieces, curtainOpacity,
                          distanceBetweenCurtainPieces, curtainCurveStep,
                          curtainCurvesWidth)
        if vs.PDrawTheCurts:
            curtain.DrawCurtain()
示例#4
0
	def Draw(self):


		if self.leafType == kTypeNone:

			vs.BeginGroup()

			glassWidth 		= self.width  
			glassHeight 	= self.height
			glassThikness	= self.__glassThikness
			glassOrigin		= (0, 0)
			pathDirection	= (0, -1)

			vs.DSelectAll()
			vs.BeginXtrd( 0, glassThikness)
			vs.RectangleN( glassOrigin, pathDirection, glassWidth, glassHeight )
			hGlass = vs.LNewObj()
			vs.EndXtrd()

			vs.Set3DRot(hGlass, 0, 40, 0, 0, 0, 0)

			vs.EndGroup()
			hLeaf = vs.LNewObj()
			
			#position at origin with needed orientation
			vs.Set3DRot(hLeaf, 0, -90,   0, 0, 0, 0)
			vs.Move3DObj(hLeaf, self.__frameThickness/2, 0, 0)
			vs.Set3DRot(hLeaf, 0,   0, 90, 0, 0, 0)



		if self.leafType != kTypeNone:
				
			vs.BeginGroup()
			#Prepare Extrude Path
			pathWidth = self.width + self.__frameOverlap*2
			pathHeight = self.height + self.__frameOverlap*2
			pathOrigin = ( -self.__frameOverlap, self.__frameOverlap )
			pathDirection = (0, -1)

			vs.RectangleN( pathOrigin, pathDirection, pathWidth, pathHeight)
			hFramePath = vs.LNewObj()

			vs.SetPlanarRefIDToGround(hFramePath);
			hFramePath = vs.ConvertToNURBS(hFramePath, False)

			#Prepare Extrude Profile


			frameProfile = (
							self.__frameOverlap, 0,
							self.__frameWidth, 0, 										
							self.__frameWidth, self.__frameThickness,
							0, self.__frameThickness,
							0, self.__frameInsideThinckness,
							self.__frameOverlap, self.__frameInsideThinckness
							)



			vs.ClosePoly()
			vs.Poly(*frameProfile)
			hFrameProfile = vs.LNewObj()

			hFrameProfilePolyline = vs.MakePolyline(hFrameProfile)
			vs.DelObject(hFrameProfile)
			hFrameProfile = hFrameProfilePolyline

			
			hLeafFrame = vs.ExtrudeAlongPath(hFramePath, hFrameProfile)

			vs.DelObject(hFramePath)
			vs.DelObject(hFrameProfile)

			#insert glass
			glassWidth 		= self.width  - 2*self.__frameMainWidth
			glassHeight 	= self.height - 2*self.__frameMainWidth
			glassThikness	= self.__glassThikness
			glassOrigin		= (self.__frameMainWidth, -self.__frameMainWidth)

			vs.DSelectAll()
			vs.BeginXtrd(self.__frameThickness/2, self.__frameThickness/2 + glassThikness)
			vs.RectangleN( glassOrigin, pathDirection, glassWidth, glassHeight )
			hGlass = vs.LNewObj()
			vs.EndXtrd()

			vs.EndGroup()
			hLeaf = vs.LNewObj()


			#position at origin with needed orientation
			vs.Set3DRot(hLeaf, 0, -90,   0, 0, 0, 0)
			vs.Set3DRot(hLeaf, 0,   0, 180, 0, 0, 0)
			vs.Move3DObj(hLeaf, 0, -self.width, 0)
			vs.Set3DRot(hLeaf, 0,   0, 90, 0, 0, 0)
			



		#move to required position
		vs.Move3DObj(hLeaf, self.position[0], self.position[1], self.position[2], )


		if self.isGlassTrue == True:
			vs.SetFillBack(hGlass, 11)
			vs.SetOpacity(hGlass, 50)

		else:
			vs.SetFillBack(hGlass, 8)
			vs.SetOpacity(hGlass, 100)



		self.hLeaf = hLeaf