コード例 #1
0
ファイル: vectorworks.py プロジェクト: robertjaniak/dlibrary
 def instance(self) -> AbstractKeyedObject:
     """Will return the instance, represented by PluginObject, or None if in definition 'mode'.
     :rtype: PluginObject
     """
     succeeded, name, plugin_handle, record_handle, wall_handle = vs.GetCustomObjectInfo(
     )
     return ObjectRepository().get(plugin_handle) if succeeded else None
コード例 #2
0
 def __MoveLedge(self, hLedge):
     if self.__fType == LedgeType.AttachToWall:
         # to Wall
         vs.Move3DObj(
             hLedge, -(self.__fWindowWidth * kLedgeOutWindow) / 2.0,
             -self.__fLedgeWidth / 2.0 - self.__fFrameWidthOffset / 2.0,
             self.__fLedgeHeight +
             (self.__fWindowHeight * kLedgeOffsetFromWindow))
     else:
         isSuccessful, objName, objHand, recHand, wallHand = vs.GetCustomObjectInfo(
         )
         if isSuccessful and (vs.GetTypeN(wallHand) == 68
                              or vs.GetTypeN(wallHand) == 89
                              ):  # not sure if correct (need wall to test)
             # to Window
             startTopHeight, startBotHeight, endTopHeight, endBotHeight = vs.GetWallHeight(
                 wallHand)
             vs.Move3DObj(
                 hLedge, -(self.__fWindowWidth * kLedgeOutWindow) / 2.0,
                 -(kLedgeOffsetFromWall * self.__fLedgeWidth) /
                 -self.__fLedgeWidth / 2.0 - self.__fFrameWidthOffset / 2.0,
                 vs.Abs(endTopHeight - endBotHeight))
         else:
             self.__fType = LedgeType.AttachToWall
             vs.Move3DObj(
                 hLedge, -(self.__fWindowWidth * kLedgeOutWindow) / 2.0,
                 -self.__fLedgeWidth / 2.0 - self.__fFrameWidthOffset / 2.0,
                 self.__fLedgeHeight +
                 (self.__fWindowHeight * kLedgeOffsetFromWindow))
     return hLedge
コード例 #3
0
def execute():
    oip = PictureOIP()
    _, param_name, param_handle, param_rec_handle, wall_handle = vs.GetCustomObjectInfo()

    the_event, the_button = vs.vsoGetEventInfo()

    if the_event == kObjOnInitXProperties:
        oip.create()
    elif the_event == kObjOnWidgetPrep:
        oip.update_parameters_state(param_handle)
    elif the_event == kParametricRecalculate:
        reset_event_handler(param_handle)
        vs.vsoStateClear(param_handle)
    elif the_event == kObjOnAddState:
        _ = vs.vsoStateAddCurrent(param_handle, the_button)
コード例 #4
0
 def __SetCurtainStyle( self ):
     isSuccessful, objName, objHand, recHand, wallHand = vs.GetCustomObjectInfo()
     if isSuccessful:
         if vs.IsNewCustomObject( objName ):
             refNum = -1
         else:
             refNum = vs.Name2Index( vs.GetRField( objHand, objName, "__CurtainTexture" ) )
         
         textureObj = Texture( vs.GetPluginString( 4020 ), refNum, self.__fColor, self.__fOpacity )
         textureIndex, textureName = textureObj.GetTexture()
             
         for pieceH in self.__fPiecesHandles:
             if pieceH:
                 vs.SetTextureRef( pieceH, textureIndex, 0 )
                 
         vs.SetRField( objHand, objName, "__CurtainTexture", textureName )
コード例 #5
0
ファイル: window.py プロジェクト: jacob-ditkoff/SDKExamples
def main():
    # Define globals
    global gObjName, gObjHandle, gRecordHandle, gWallHandle
    ok, gObjName, gObjHandle, gRecordHandle, gWallHandle = vs.GetCustomObjectInfo(
    )
    if gObjHandle == vs.Handle():
        gObjName = 'Window with Curtains'
        gObjHandle = vs.GetObject(gObjName)  # get the format

    # Get event
    theEvent, theEventData = vs.vsoGetEventInfo()
    if theEvent == Constants.kObjOnInitXProperties:
        ok = vs.SetObjPropVS(Constants.kObjXPropPreference, True)
        ok = vs.SetObjPropVS(Constants.kObjXPropHasUIOverride, True)
        ok = vs.SetObjPropVS(Constants.kObjXHasCustomWidgetVisibilities, True)

        InitProps()

    elif theEvent == Constants.kObjOnWidgetPrep:
        UpdateParams()
        # to do: set visibilities
        # ...
        # this is very important! this is how the system knows we've handled this
        vs.vsoSetEventResult(Constants.kObjectEventHandled)

    elif theEvent == Constants.kParametricPreference:
        #Call the preferences window as the object is created or prefs button is clicked
        CurtWindowDlg.Dialog(gObjHandle)

    elif theEvent == Constants.kObjOnObjectUIButtonHit:
        OnButton(theEventData)

    elif theEvent == Constants.kParametricRecalculate:
        #Check the values, which the user enters in the OIP
        CheckValues()
        Reset()
コード例 #6
0
ファイル: vectorworks.py プロジェクト: robertjaniak/dlibrary
 def __init_name(self):
     self.__name = vs.GetFldName(vs.GetCustomObjectInfo()[3], self.__index)
コード例 #7
0
ファイル: vectorworks.py プロジェクト: robertjaniak/dlibrary
 def handle(self) -> vs.Handle:
     """Will return the instance or definition handle of an object plugin.
     """
     succeeded, name, plugin_handle, record_handle, wall_handle = vs.GetCustomObjectInfo(
     )
     return plugin_handle if succeeded else vs.GetObject(self.name)