//********************************************************************** private void Init() { radio_BandW.Checked = true; m_ColMode = Autodesk.Revit.DB.ImportColorMode.BlackAndWhite; //folderBrowser string path = ((Data)(ThisExtension.GetData())).OptionPath; if (!Directory.Exists(path)) { path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } folderBrowserDialogDwg.SelectedPath = path; m_Directory = folderBrowserDialogDwg.SelectedPath; m_SavedDirectory = m_Directory; folderBrowserDialogDwg.Description = Resources.Strings.Texts.ChooseFolder; //combo version combo_Version.Items.Add("2000"); combo_Version.Items.Add("2004"); combo_Version.Items.Add("2007"); m_ComboVersionItem = 2; m_SavedComboVersionItem = 2; check_CopyDwg.Checked = false; m_CopyCheck = false; CopyCheckChange(false); m_deleteViews = false; check_Delete.Checked = false; this.Icon = ThisExtension.GetIcon(); }
private void ButtonClose_Click(object sender, RoutedEventArgs e) { REXCommand Cmd = new REXCommand(REXCommandType.Close); Cmd.CommandObject = false; ThisExtension.Command(ref Cmd); }
/// <summary> /// Fills the note according current settings /// </summary> public void SetDialog() { if (HtmlDocument != null) { HtmlDocument = null; ThisExtension.ROHTMLReleaseDocument(); } HtmlDocument = ThisExtension.ROHTMLDocument(); if (File.Exists(DocumentPath)) { try { File.Delete(DocumentPath); } catch { } } Guid g = System.Guid.NewGuid(); DocumentPath = GetTempPath() + "\\" + g.ToString() + ".mht"; HtmlDocument.Body.AddHeader(1, "Pyramid parameters"); string textH = ThisExtension.Units.DisplayTextFromBase(ThisMainExtension.Data.H, Autodesk.REX.Framework.EUnitType.Dimensions_StructureDim, true); HtmlDocument.Body.AddValue2("H", textH); string textB = ThisExtension.Units.DisplayTextFromBase(ThisMainExtension.Data.B, Autodesk.REX.Framework.EUnitType.Dimensions_StructureDim, true); HtmlDocument.Body.AddValue2("B", textB); HtmlDocument.SaveAsSingleFile(DocumentPath); webBrowser.Navigate(new Uri(DocumentPath)); }
public DialogViewSel(REXExtension argExt) : base(argExt) { m_REXViewList = new List <REXView>(); InitializeComponent(); this.Icon = ThisExtension.GetIcon(); }
private void ButtonApply_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; REXCommand Cmd = new REXCommand(REXCommandType.OK); ThisExtension.Command(ref Cmd); }
private void ButtonClose_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; REXCommand Cmd = new REXCommand(REXCommandType.Close); Cmd.CommandObject = false; ThisExtension.Command(ref Cmd); }
/// <summary> /// Fills the note. /// </summary> public void FillNote() { if (HtmlDocument != null) { HtmlDocument = null; ThisExtension.ROHTMLReleaseDocument(); } HtmlDocument = ThisExtension.ROHTMLDocument(); FillHeaderNote(); if (ThisMainExtension.Data.IdMode) { if (ThisMainExtension.Data.SelectedElement != null) { AddElementToNote(ThisMainExtension.Data.SelectedElement); } } else { FillGeneralInformation(); foreach (Node categoryNode in ThisMainExtension.Data.MainNode.Nodes.Values) { if (!ThisMainExtension.Data.SelectedCategories.Contains(categoryNode)) { continue; } AddCategoryToNote(categoryNode); foreach (Node elementNode in categoryNode.Nodes.Values) { AddElementToNote(elementNode); } } } if (File.Exists(DocumentPath)) { try { File.Delete(DocumentPath); } catch { } } Guid g = System.Guid.NewGuid(); DocumentPath = GetTempPath() + "\\" + g.ToString() + ".mht"; HtmlDocument.SaveAsSingleFile(DocumentPath); webBrowser.Navigate(new Uri(DocumentPath)); }
private void REXExtensionWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { REXCommand Cmd = new REXCommand(REXCommandType.Close); Cmd.CommandObject = true; if (((bool)ThisExtension.Command(ref Cmd)) == true) { e.Cancel = false; } else { e.Cancel = true; } }
private void RunCommand(string Name) { REXCommand Cmd = null; switch (Name) { case "MenuItemOpen": case "ToolStripButtonOpen": case "ToolStripMenuItemOpen": ThisExtension.System.LoadFromFile(true); return; case "MenuItemSave": case "ToolStripButtonSave": case "ToolStripMenuItemSave": ThisExtension.System.SaveToFile(false, true); return; case "MenuItemSaveAs": case "ToolStripMenuItemSaveAs": ThisExtension.System.SaveToFile(true); return; case "MenuItemCalc": case "ToolStripButtonCalc": case "ToolStripMenuItemCalc": Cmd = new REXCommand(REXCommandType.Run); break; case "MenuItemHelpIndex": case "ToolStripButtonHelp": case "ToolStripMenuItemHelp": Cmd = new REXCommand(REXCommandType.Help); break; case "MenuItemClose": case "ToolStripMenuItemClose": Cmd = new REXCommand(REXCommandType.Close); break; case "MenuItemAbout": case "ToolStripMenuItemAbout": Cmd = new REXCommand(REXCommandType.About); break; } if (Cmd != null) { ThisExtension.Command(ref Cmd); } }
public void init() { combo_layMap.Items.Add(Resources.Strings.Texts.Default); combo_layMap.Items.Add(Resources.Strings.Texts.AIA); combo_layMap.Items.Add(Resources.Strings.Texts.CP38); combo_layMap.Items.Add(Resources.Strings.Texts.BS1192); combo_layMap.Items.Add(Resources.Strings.Texts.ISO13567); combo_layMap.SelectedIndex = 0; combo_lineScale.Items.Add(Resources.Strings.Texts.ModelSpace); combo_lineScale.Items.Add(Resources.Strings.Texts.PaperSpace); combo_lineScale.Items.Add(Resources.Strings.Texts.ViewScale); combo_lineScale.SelectedIndex = 0; combo_units.Items.Add(Resources.Strings.Texts.Milimiter); combo_units.Items.Add(Resources.Strings.Texts.Centimeter); combo_units.Items.Add(Resources.Strings.Texts.Meter); combo_units.Items.Add(Resources.Strings.Texts.Inch); combo_units.Items.Add(Resources.Strings.Texts.Foot); if (ThisExtension.Revit.CommandData().Application.ActiveUIDocument.Document.DisplayUnitSystem == Autodesk.Revit.DB.DisplayUnit.METRIC) { combo_units.SelectedIndex = 2; } else { combo_units.SelectedIndex = 4; } combo_layAndProp.Items.Add(Resources.Strings.Texts.ByEntity); combo_layAndProp.Items.Add(Resources.Strings.Texts.ByLayer); combo_layAndProp.Items.Add(Resources.Strings.Texts.NewLayer); combo_layAndProp.SelectedIndex = 0; combo_Coord.Items.Add(Resources.Strings.Texts.ProjectInternal); combo_Coord.Items.Add(Resources.Strings.Texts.Shared); combo_Coord.SelectedIndex = 0; check_exportRooms.Checked = false; m_coord = combo_Coord.SelectedIndex; m_layAndProp = combo_layAndProp.SelectedIndex; m_layMap = combo_layMap.SelectedIndex; m_lineScale = combo_lineScale.SelectedIndex; m_units = combo_units.SelectedIndex; m_exportRooms = check_exportRooms.Checked; this.Icon = ThisExtension.GetIcon(); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { this.DialogResult = DialogResult.Cancel; REXCommand Cmd = new REXCommand(REXCommandType.Close); Cmd.CommandObject = true; if (((bool)ThisExtension.Command(ref Cmd)) == true) { e.Cancel = false; } else { e.Cancel = true; } }
/// <summary> /// Called when save data. /// </summary> /// <param name="Data">The data.</param> /// <returns>Returns true if succeeded.</returns> protected override bool OnSave(ref BinaryWriter Data) { if (Mode == DataMode.ModeFile) { } if (Mode == DataMode.ModeProject) { } if (Mode == DataMode.ModeObject) { } ThisExtension.OnSetData(); Data.Write(NbX); Data.Write(NbY); Data.Write(SpacingX); Data.Write(SpacingY); return(true); }
private void RunCommand(string Name) { REXCommand Cmd = null; switch (Name) { case "Open": ThisExtension.System.LoadFromFile(true); return; case "Save": ThisExtension.System.SaveToFile(false, true); return; case "SaveAs": ThisExtension.System.SaveToFile(true); return; case "Calculate": Cmd = new REXCommand(REXCommandType.Run); break; case "Help": Cmd = new REXCommand(REXCommandType.Help); break; case "Close": Cmd = new REXCommand(REXCommandType.Close); break; case "About": Cmd = new REXCommand(REXCommandType.About); break; case "Preferences": ThisExtension.ShowPreferencesDialog(); break; } if (Cmd != null) { ThisExtension.Command(ref Cmd); } }
/// <summary> /// Runs process calculations or other operations. /// </summary> public override void OnRun() { //Step 4.9.: Extension class double b = ThisExtension.Units.Interface(ThisMainExtension.Data.B, EUnitType.Dimensions_StructureDim, 1, REXInterfaceType.Revit); double h = ThisExtension.Units.Interface(ThisMainExtension.Data.H, EUnitType.Dimensions_StructureDim, 1, REXInterfaceType.Revit); double x1 = 0; double y1 = 0; double x2 = b; double y2 = 0; double x3 = b / 2; double y3 = b * Math.Sqrt(3) / 2; double x4 = b / 2; double y4 = y3 / 3; FamilySymbol familySymbol = Families[ThisMainExtension.Data.FamilySymbol]; ThisExtension.Progress.Steps = 6; ThisExtension.Progress.Header = "Generation"; ThisExtension.Progress.Text = "..."; ThisExtension.Progress.Show(ThisExtension.GetWindowForParent()); RemoveAllGeneratedBeams(); ThisMainExtension.Data.ElementIds.Clear(); GenerateBeam(new XYZ(x1, y1, 0), new XYZ(x2, y2, 0), familySymbol); GenerateBeam(new XYZ(x2, y2, 0), new XYZ(x3, y3, 0), familySymbol); GenerateBeam(new XYZ(x1, y1, 0), new XYZ(x3, y3, 0), familySymbol); GenerateBeam(new XYZ(x1, y1, 0), new XYZ(x4, y4, h), familySymbol); GenerateBeam(new XYZ(x2, y2, 0), new XYZ(x4, y4, h), familySymbol); GenerateBeam(new XYZ(x3, y3, 0), new XYZ(x4, y4, h), familySymbol); SaveDataToAllBeams(); ThisExtension.Progress.Hide(); }
/// <summary> /// Called when load data. /// </summary> /// <param name="Data">The data.</param> /// <returns>Returns true if succeeded.</returns> protected override bool OnLoad(ref BinaryReader Data) { if (Mode == DataMode.ModeFile) { } if (Mode == DataMode.ModeProject) { } if (Mode == DataMode.ModeObject) { } if (VersionLoaded >= 1) { NbX = Data.ReadDouble(); NbY = Data.ReadDouble(); SpacingX = Data.ReadDouble(); SpacingY = Data.ReadDouble(); ThisExtension.OnSetDialogs(); } return(true); }
/// <summary> /// Handles the Click event of the ToolStripButtonSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void ToolStripButtonSave_Click(object sender, RoutedEventArgs e) { if (HtmlDocument == null) { return; } Microsoft.Win32.SaveFileDialog SaveFileDialog = new Microsoft.Win32.SaveFileDialog(); SaveFileDialog.Filter = "MHT (*.mht) file|*.mht|HTML (*.html) file|*.html;"; SaveFileDialog.OverwritePrompt = true; if (SaveFileDialog.ShowDialog(ThisExtension.GetWindowForParent()) == true) { if (System.IO.Path.GetExtension(SaveFileDialog.FileName).ToLower() == ".mht") { HtmlDocument.SaveAsSingleFile(SaveFileDialog.FileName); } else { HtmlDocument.Save(SaveFileDialog.FileName); } } }
private void HyperlinkAbout_Click(object sender, RoutedEventArgs e) { REXCommand Cmd = new REXCommand(REXCommandType.About); ThisExtension.Command(ref Cmd); }
public DialogMessageExists(REXExtension argExt) : base(argExt) { InitializeComponent(); Context = REX.DRevitFreezeDrawing.Main.ReplaceContext.Replace; this.Icon = ThisExtension.GetIcon(); }
private void ButtonApply_Click(object sender, RoutedEventArgs e) { REXCommand Cmd = new REXCommand(REXCommandType.OK); ThisExtension.Command(ref Cmd); }
/// <summary> /// Fills the header note. /// </summary> private void FillHeaderNote() { Autodesk.REX.Framework.REXEnvironment Env = new Autodesk.REX.Framework.REXEnvironment(REX.Common.REXConst.ENG_DedicatedVersionName); string path = Env.GetModulePath(Autodesk.REX.Framework.REXEnvironment.PathType.Configuration, ThisExtension.ThisApplication.Context.Name); string imagePath = REX.Common.REXController.GetProductBitmapFullPath(ThisContext, ThisExtension.GetREXEnvironment(), (REXInterfaceType)ThisExtension.ExtensionContext.Control.StandardOwner, false); string ModVersion = ThisExtension.ThisApplication.GetType().Assembly.GetName().Version.Major.ToString() + "." + ThisExtension.ThisApplication.GetType().Assembly.GetName().Version.Minor.ToString(); string createHeader = "<table border = 1 style = \"border:#eeeeee\" width =\"100%\">" + "<tr height=\"40\">" + "<td rowspan = \"4\" align=\"center\" valign=\"center\" width = \"10%\" style = \"border: 1px solid #eeeeee\"><img src=\"" + imagePath + "\"" + "</td>" + "<td align=\"left\" valign=\"center\" width = \"90%\" bgcolor = \"#eeeeee\" style = \"border: 0px solid #eeeeee\" >" + "<font size = 4 face=\"Arial\">Element Report</font></br>" + "</td>" + "</tr>" + "<tr height=\"20\">" + "<td align=\"left\" valign=\"center\" width = \"90%\" bgcolor = \"#eeeeee\" style = \"border: 0px solid #eeeeee\" >" + "<font size = 1 color = \"gray\" >REXSDK 2012</font></br>" + "</td>" + "</tr>" + "</table>"; HtmlDocument.Body.AddLine(createHeader); HtmlDocument.Body.AddLineBreak(); }
//****************************************************************************************** /// <summary> /// this function gets view nam based on file name /// </summary> private bool CopyToUserDirViewPath(ViewPath argView, string argBaseName, string argBrowse, DialogMessageExists dlgMsg) { string newFileName; if (argBaseName != "") { newFileName = argBrowse + "\\" + argBaseName + "-" + argView.DraftingName + ".dwg"; } else { newFileName = argBrowse + "\\" + argView.DraftingName + ".dwg"; } string dirref = Directory.GetParent(argView.path).FullName; string dwgreffile = argView.fullViewName.Replace(" ", ""); string dwgref = Path.GetFileNameWithoutExtension(dwgreffile) + "-*.dwg"; string dwggrefpath = GetRefDWGFilePath(dwgref, dirref); string dd = Path.GetFileName(dwggrefpath); string dwgrefdestpath = Path.Combine(argBrowse, dd); if (File.Exists(newFileName)) { if (dlgMsg.Context == ReplaceContext.Leave || dlgMsg.Context == ReplaceContext.Replace) { dlgMsg.ShowMessageDialog(newFileName, ThisExtension.GetForm()); if (dlgMsg.Context == ReplaceContext.Replace || dlgMsg.Context == ReplaceContext.ReplaceAll) { try { File.Copy(argView.path, newFileName, true); if (dwggrefpath != "") { File.Copy(dwggrefpath, dwgrefdestpath, true); } return(true); } catch { System.Windows.Forms.MessageBox.Show(ThisExtension.GetForm(), Resources.Strings.Texts.ErrorAccessDenied + newFileName, Resources.Strings.Texts.REX_ModuleDescription); return(false); } } return(true); } else if (dlgMsg.Context == ReplaceContext.ReplaceAll) { try { File.Copy(argView.path, newFileName, true); if (dwggrefpath != "") { File.Copy(dwggrefpath, dwgrefdestpath, true); } return(true); } catch { System.Windows.Forms.MessageBox.Show(ThisExtension.GetForm(), Resources.Strings.Texts.ErrorAccessDenied + newFileName, Resources.Strings.Texts.REX_ModuleDescription); return(false); } } else { return(true); } } else { global::System.IO.File.Copy(argView.path, newFileName); if (dwggrefpath != "") { System.IO.File.Copy(dwggrefpath, dwgrefdestpath, true); } return(true); } }
private void About_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { REXCommand Cmd = new REXCommand(REXCommandType.About); ThisExtension.Command(ref Cmd); }
/// <summary> /// Handles the Click event of the buttonDBSelect control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void buttonDBSelect_Click(object sender, RoutedEventArgs e) { System.Windows.Interop.WindowInteropHelper helper = new System.Windows.Interop.WindowInteropHelper(ThisExtension.GetWindowForParent()); if (DBExplorerDialogManager.ShowContentDialogParentIntPtr(DBExplorerSettings, helper.Handle)) { this.DatabaseSection = DBExplorerSettings.SectionDBSettings.SelectedElement as REX.ContentGenerator.Families.REXFamilyType_DBSection; UpdateDatabaseSectionProperties(); } }