private void btnStart_Click(object sender, EventArgs e)
        {
            activeIndex  = 0;
            activeNote   = noteList[activeIndex];
            haveNextNote = true;
            // this.Visible = false;
            swApp = Comm.ConnectToSolidWorks();

            swModel = (ModelDoc2)swApp.ActiveDoc;

            swModelDocExt = swModel.Extension;

            swModelView = (ModelView)swModel.GetFirstModelView();

            TheMouse = swModelView.GetMouse();

            mouseClass mouseClass = new mouseClass(this);

            Frame swFrame = (Frame)swApp.Frame();

            swFrame.SetStatusBarText("Next Click  to insert " + activeNote);

            TheMouse.MouseSelectNotify += mouseClass.ms_MouseSelectNotify;

            Debug.Print("done");
        }
Beispiel #2
0
        public Thumbnailer(SldWorks sw)
        {
            swApp = sw;
            APathSet.ShtFmtPath = @"\\AMSTORE-SVR-22\cad\Solid Works\AMSTORE_SHEET_FORMATS\zPostCard.slddrt";
            swFrame             = (Frame)swApp.Frame();
            swModel             = (ModelDoc2)swApp.ActiveDoc;
            swDraw = (DrawingDoc)swModel;

            if (swApp == null)
            {
                throw new ThumbnailerException("I know you gave me the SW Application Object, but I dropped it somewhere.");
            }

            if (swDraw == null)
            {
                throw new ThumbnailerException("You must having a drawing document open.");
            }

            swView = GetFirstView(swApp);

            sourcePath = swView.GetReferencedModelName().ToUpper().Trim();

            if (!sourcePath.Contains("SLDASM"))
            {
                assmbly = false;
            }

            drawingPath = swModel.GetPathName().ToUpper().Trim();
        }
Beispiel #3
0
        public Thumbnailer(SldWorks sw, ArchivePDF.csproj.PathSet ps)
        {
            swApp    = sw;
            APathSet = ps;

            swFrame = (Frame)swApp.Frame();
            swModel = (ModelDoc2)swApp.ActiveDoc;
            swDraw  = (DrawingDoc)swModel;

            if (swApp == null)
            {
                throw new ThumbnailerException("I know you gave me the SW Application Object, but I dropped it somewhere.");
            }

            if (swDraw == null)
            {
                throw new ThumbnailerException("You must having a drawing document open.");
            }

            swView = GetFirstView(swApp);

            sourcePath = swView.GetReferencedModelName().ToUpper().Trim();

            if (!sourcePath.Contains("SLDASM"))
            {
                assmbly = false;
            }

            drawingPath = swModel.GetPathName().ToUpper().Trim();
        }
Beispiel #4
0
        private void _setupSW()
        {
            swFrame = (Frame)swApp.Frame();
            swModel = (ModelDoc2)swApp.ActiveDoc;
            swDraw  = (DrawingDoc)swModel;

            if (swDraw == null)
            {
                throw new GaugeSetterException("You must have a Drawing Document open.");
            }
        }
Beispiel #5
0
        //private Boolean shouldCheck = true;

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="sw">Requires a <see cref="SolidWorks.Interop.sldworks.SldWorks"/> type.</param>
        /// <param name="ps">Requires a <see cref="ArchivePDF.csproj.PathSet"/></param>
        public PDFArchiver(ref SldWorks sw, ArchivePDF.csproj.PathSet ps)
        {
            swApp    = sw;
            APathSet = ps;
            swModel  = (ModelDoc2)swApp.ActiveDoc;
            ModelDocExtension ex  = (ModelDocExtension)swModel.Extension;
            string            lvl = GetRev(ex);

            if (DocCheck())
            {
                if (swModel.GetType() != (int)swDocumentTypes_e.swDocDRAWING)
                {
                    throw new ExportPDFException("You must have a Drawing Document open.");
                }
                swDraw  = (DrawingDoc)swModel;
                swFrame = (Frame)swApp.Frame();

                swView      = GetFirstView(swApp);
                metal       = IsMetal(swView);
                sourcePath  = swView.GetReferencedModelName().ToUpper().Trim();
                drawingPath = swModel.GetPathName().ToUpper().Trim();

                if (sourcePath.Contains("SLDASM"))
                {
                    modelType = swDocumentTypes_e.swDocASSEMBLY;
                }
                else if (sourcePath.Contains("SLDPRT"))
                {
                    modelType = swDocumentTypes_e.swDocPART;
                }
                else
                {
                    modelType = swDocumentTypes_e.swDocNONE;
                }
            }
            else
            {
                MustSaveException e = new MustSaveException("The drawing has to be saved.");
                throw e;
            }
        }