Example #1
0
 void ShowMsg(ExportStep step)
 {
     if (!_free)
     {
         IsoUploadInfoWndCtrl.Instance.UpdateIsoState(instanceId, RealFileName, (int)step);
     }
 }
Example #2
0
        int IExportStep.Export(ExportStep export, bool topLevel)
        {
            // #63=LINE('',#60,#62) ;
            int p1  = (startPoint as IExportStep).Export(export, false); // unfortunately we don't know about vertices here, so we cannot use them
            int dir = ((EndPoint - StartPoint) as IExportStep).Export(export, false);
            int vec = export.WriteDefinition("VECTOR('',#" + dir.ToString() + ",1.)");
            int ln  = export.WriteDefinition("LINE('',#" + p1.ToString() + ",#" + vec.ToString() + ")");

            if (topLevel)
            {   // export as a geometric curve set of a single trimmed curve
                // #37 = GEOMETRIC_CURVE_SET('',(#38));
                // #38 = TRIMMED_CURVE('',#39,(#43,PARAMETER_VALUE(0.E+000)),(#44,PARAMETER_VALUE(62.52263230373)),.T.,.PARAMETER.);
                int      sp  = (startPoint as IExportStep).Export(export, false);
                int      ep  = (endPoint as IExportStep).Export(export, false);
                int      tc  = export.WriteDefinition("TRIMMED_CURVE('',#" + ln.ToString() + ",(#" + sp.ToString() + ",PARAMETER_VALUE(0.0)),(#" + ep.ToString() + ",PARAMETER_VALUE(" + export.ToString(Length) + ")),.T.,.CARTESIAN.)");
                int      gcs = export.WriteDefinition("GEOMETRIC_CURVE_SET('',(#" + tc.ToString() + "))"); // is a Representation_Item
                ColorDef cd  = ColorDef;
                if (cd == null)
                {
                    cd = new ColorDef("Black", Color.Black);
                }
                cd.MakeStepStyle(gcs, export);
                int product = export.WriteDefinition("PRODUCT( '','','',(#2))");
                int pdf     = export.WriteDefinition("PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE( ' ', 'NONE', #" + product.ToString() + ", .NOT_KNOWN. )");
                int pd      = export.WriteDefinition("PRODUCT_DEFINITION( 'NONE', 'NONE', #" + pdf.ToString() + ", #3 )");
                int pds     = export.WriteDefinition("PRODUCT_DEFINITION_SHAPE( 'NONE', 'NONE', #" + pd.ToString() + " )");
                int sr      = export.WriteDefinition("SHAPE_REPRESENTATION('', ( #" + gcs.ToString() + "), #4 )");
                export.WriteDefinition("SHAPE_DEFINITION_REPRESENTATION( #" + pds.ToString() + ", #" + sr.ToString() + ")");
                return(sr);
            }
            else
            {
                return(ln);
            }
        }
Example #3
0
 internal void SteamFileWrite()
 {//step 2 正在上传iso主体文件到steam workshop;
     try
     {
         ShowMsg(ExportStep.RealFileSending);
         if (!SteamRemoteStorage.FileWrite(_FileName, _Data, _Data.Length))
         {
             throw new Exception("File write failed. File Name:" + _FileName);
         }
         SteamAPICall_t handler = new SteamAPICall_t();
         //step 3、正在为其他玩家共享iso;
         _step = ExportStep.Shareing;
         ShowMsg(_step);
         handler = SteamRemoteStorage.FileShare(_FileName);
         _handler.Add(handler);
         RemoteStorageFileShareResult.Set(handler);
     }
     catch (Exception)
     {
         if (CallBackSteamUploadResult != null)
         {
             CallBackSteamUploadResult(_ID, false, _hashCode);
         }
         SteamRemoteStorage.FileDelete(_PreFileName);
         //step 6 导出失败
         _step = ExportStep.ExportFailed;
         ShowMsg(_step);
     }
 }
Example #4
0
 internal void MakeStepStyle(int msb, ExportStep export)
 {
     //#23=COLOUR_RGB('Colour',0.,0.501960784314,1.) ;
     //#24=FILL_AREA_STYLE_COLOUR(' ',#23) ;
     //#25=FILL_AREA_STYLE(' ',(#24)) ;
     //#26=SURFACE_STYLE_FILL_AREA(#25) ;
     //#27=SURFACE_SIDE_STYLE(' ',(#26)) ;
     //#28=SURFACE_STYLE_USAGE(.BOTH.,#27) ;
     //#29=PRESENTATION_STYLE_ASSIGNMENT((#28)) ;
     //#30=STYLED_ITEM(' ',(#29),#22) ;
     //#60 = DRAUGHTING_PRE_DEFINED_COLOUR('red');
     //#61 = CURVE_STYLE('',#62,POSITIVE_LENGTH_MEASURE(0.1),#60);
     //#62 = DRAUGHTING_PRE_DEFINED_CURVE_FONT('continuous');
     //#63 = MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(#64),
     if (!export.StyledItems.TryGetValue(this, out int psa))
     {
         int clr = export.WriteDefinition("COLOUR_RGB('" + Name + "'," + export.ToString(color.R / 255.0) + ","
                                          + export.ToString(color.G / 255.0) + "," + export.ToString(color.B / 255.0) + ")");
         int cnt = export.WriteDefinition("DRAUGHTING_PRE_DEFINED_CURVE_FONT('continuous')");
         int cs  = export.WriteDefinition("CURVE_STYLE(' ',#" + cnt.ToString() + ",POSITIVE_LENGTH_MEASURE(0.1),#" + clr.ToString() + ")");
         int fac = export.WriteDefinition("FILL_AREA_STYLE_COLOUR(' ',#" + clr.ToString() + ")");
         int fas = export.WriteDefinition("FILL_AREA_STYLE(' ',(#" + fac.ToString() + "))");
         int ssf = export.WriteDefinition("SURFACE_STYLE_FILL_AREA(#" + fas.ToString() + ")");
         int sss = export.WriteDefinition("SURFACE_SIDE_STYLE(' ',(#" + ssf.ToString() + "))");
         int ssu = export.WriteDefinition("SURFACE_STYLE_USAGE(.BOTH.,#" + sss.ToString() + ")");
         psa = export.WriteDefinition("PRESENTATION_STYLE_ASSIGNMENT((#" + ssu.ToString() + "))");
         export.StyledItems[this] = psa;
     }
     export.WriteDefinition("STYLED_ITEM(' ',(#" + psa.ToString() + "),#" + msb.ToString() + ")");
 }
Example #5
0
        int IExportStep.Export(ExportStep export, bool topLevel)
        {
            /*
             #248 = ADVANCED_BREP_SHAPE_REPRESENTATION( 'Assem1', ( #717, #718, #719, #720, #721, #722, #723, #724, #725, #726, #727 ), #26 );
             #727 = AXIS2_PLACEMENT_3D( '', #1437, #1438, #1439 );
             #717 = MAPPED_ITEM( '', #1417, #1418 );
             #1417 = REPRESENTATION_MAP( #727, #251 );
             #1418 = AXIS2_PLACEMENT_3D( '', #2213, #2214, #2215 );
             #251 = ADVANCED_BREP_SHAPE_REPRESENTATION( 'A0501_SASIL_plus_00_50_185_3_polig', ( #730 ), #26 );
             */
            List <int> representationItems = new List <int>();
            int        mainAxis            = export.WriteAxis2Placement3d(GeoPoint.Origin, GeoVector.ZAxis, GeoVector.XAxis);

            for (int i = 0; i < containedObjects.Count; i++)
            {
                if (containedObjects[i] is IExportStep)
                {
                    int toMap      = (containedObjects[i] as IExportStep).Export(export, true); // true is correct here, because it is part of a map
                    int axis       = export.WriteAxis2Placement3d(GeoPoint.Origin, GeoVector.ZAxis, GeoVector.XAxis);
                    int repMap     = export.WriteDefinition("REPRESENTATION_MAP(#" + mainAxis.ToString() + ",#" + toMap.ToString() + ")");
                    int mappedItem = export.WriteDefinition("MAPPED_ITEM( '', #" + repMap.ToString() + ",#" + axis.ToString() + ")");
                    representationItems.Add(mappedItem);
                }
            }
            representationItems.Add(mainAxis);
            int sr      = export.WriteDefinition("SHAPE_REPRESENTATION('" + Name + "',(" + export.ToString(representationItems.ToArray(), true) + "),#4)");
            int product = export.WriteDefinition("PRODUCT( '" + Name + "','" + Name + "','',(#2))");
            int pdf     = export.WriteDefinition("PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE( ' ', 'NONE', #" + product.ToString() + ", .NOT_KNOWN. )");
            int pd      = export.WriteDefinition("PRODUCT_DEFINITION( 'NONE', 'NONE', #" + pdf.ToString() + ", #3 )");
            int pds     = export.WriteDefinition("PRODUCT_DEFINITION_SHAPE( 'NONE', 'NONE', #" + pd.ToString() + " )");

            export.WriteDefinition("SHAPE_DEFINITION_REPRESENTATION( #" + pds.ToString() + ", #" + sr.ToString() + ")");

            return(sr);
        }
Example #6
0
        int IExportStep.Export(ExportStep export, bool topLevel)
        {
            // #171=AXIS2_PLACEMENT_3D('Plane Axis2P3D',#168,#169,#170) ;
            int ax = export.WriteAxis2Placement3d(Location, Normal, DirectionX);

            // #172=PLANE('',#171) ;
            return(export.WriteDefinition("PLANE('',#" + ax.ToString() + ")"));
        }
Example #7
0
 public Steps(ICoreConfigSection coreConfigSection, SDBuildStrings sdBuildStrings, IConfigController configController, BuildMessenger buildMessenger, IExporter[] allExporters = null)
 {
     PreBuildStep       = new PreBuildStep(coreConfigSection, allExporters, buildMessenger, sdBuildStrings);
     LoadStep           = new LoadStep(coreConfigSection, sdBuildStrings, buildMessenger);
     ParseStep          = new ParseStep(sdBuildStrings, coreConfigSection, buildMessenger);
     StructureParseStep = new StructureParseStep(sdBuildStrings, buildMessenger);
     ExportStep         = new ExportStep(coreConfigSection, sdBuildStrings, buildMessenger, allExporters);
     EndStep            = new EndStep(configController, coreConfigSection);
 }
Example #8
0
    internal void SteamPreFileWrite()
    {//step 1 正在上传预览文件到steam workshop
        try
        {
            if (_PreData != null && _PreData.Length > 0)
            {
                _step = ExportStep.PreFileSending;
                ShowMsg(_step);
                if (!IsShared(FileName))
                {
                    if (!IsWorking(FileName))
                    {
                        if (!SteamRemoteStorage.FileWrite(_PreFileName, _PreData, _PreData.Length))
                        {
                            throw new Exception("File write failed. File Name: " + _PreFileName);
                        }
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    OnFileShared();
                }

                SteamAPICall_t handler = SteamRemoteStorage.FileShare(_PreFileName);
                _handler.Add(handler);
                RemoteStoragePreFileShareResult.Set(handler);
            }
            else
            {
                throw new Exception("Invalid file data. File Name: " + _PreFileName);
            }
        }
        catch (Exception)
        {
            if (CallBackSteamUploadResult != null)
            {
                CallBackSteamUploadResult(_ID, false, _hashCode);
            }
            //step 6 导出失败
            _step = ExportStep.ExportFailed;
            ShowMsg(_step);
        }
    }
Example #9
0
    void OnRemoteStorageFileShareResult(RemoteStorageFileShareResult_t pCallback, bool bIOFailure)
    {
        try
        {
            if (pCallback.m_eResult != EResult.k_EResultOK)
            {
                if (CallBackSteamUploadResult != null)
                {
                    CallBackSteamUploadResult(_ID, false, _hashCode);
                }
                _step = ExportStep.ExportFailed;
                ShowMsg(_step);
                return;
            }

            _UGCHandle = pCallback.m_hFile;
            OnFileShared();
            if (CallBackSteamUploadResult != null)
            {
                CallBackSteamUploadResult(_ID, true, _hashCode);
            }
            if (!_Publish)
            {
                return;
            }
            SteamAPICall_t handler = SteamRemoteStorage.PublishWorkshopFile(_FileName, _PreFileName, SteamUtils.GetAppID(),
                                                                            _RealFileName, _FileDescription, ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic,
                                                                            _Tags, EWorkshopFileType.k_EWorkshopFileTypeCommunity);
            _handler.Add(handler);
            RemoteStorageFilePublishResult.Set(handler);
        }
        catch (Exception)
        {
            Debug.Log("workshop error:" + pCallback.m_eResult);
            if (CallBackSteamUploadResult != null)
            {
                CallBackSteamUploadResult(_ID, false, _hashCode);
            }
            //step 6 导出失败
            _step = ExportStep.ExportFailed;
            ShowMsg(_step);
        }
    }
Example #10
0
 void OnRemoteStoragePreFileShareResult(RemoteStorageFileShareResult_t pCallback, bool bIOFailure)
 {
     try
     {
         if (pCallback.m_eResult != EResult.k_EResultOK)
         {
             throw new Exception("Upload iso data failed.");
         }
         SteamFileWrite();
     }
     catch (Exception)
     {
         Debug.Log("workshop error:" + pCallback.m_eResult);
         if (CallBackSteamUploadResult != null)
         {
             CallBackSteamUploadResult(_ID, false, _hashCode);
         }
         //step 6 导出失败
         _step = ExportStep.ExportFailed;
         ShowMsg(_step);
     }
 }
Example #11
0
 private void UpdateExportStepState(ExportStep step, ExportStepState state)
 {
     _ExportStepsDictionary[step].State = state;
 }
Example #12
0
        int IExportStep.Export(ExportStep export, bool topLevel)
        {
            int n = (baseSurface as IExportStep).Export(export, false);

            return(export.WriteDefinition("OFFSET_SURFACE('',#" + n.ToString() + "," + export.ToString(offset) + ",.F.)"));
        }