Skip to content

Instantly share code, notes, and snippets.

Avatar
💬
snooping open source

Chuong Ho chuongmep

💬
snooping open source
View GitHub Profile
View snoop.py
# these commands get executed in the current scope
# of each new shell (but not for canned commands)
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
from Autodesk.Revit.DB.Analysis import *
uidoc = __revit__.ActiveUIDocument
doc = __revit__.ActiveUIDocument.Document
from Autodesk.Revit.UI import TaskDialog
View convertdynamo.cs
using System.Linq;
using System.Reflection;
using Autodesk.DesignScript.Runtime;
using Autodesk.Revit.DB;
using Revit.Elements;
using RevitServices.Persistence;
using dynCategory = Revit.Elements.Category;
using dynDocument = Revit.Application.Document;
using dynElement = Revit.Elements.Element;
using dynElementSelector = Revit.Elements.ElementSelector;
View is_symmetric.py
sys.setrecursionlimit(100000)
def is_symmetric(s,i,j):
if i>=j:
return True
if s[i]!=s[j]:
return False
return is_symmetric(s,i+1,j-1)
n = int(input())
s = input()
print("YES" if is_symmetric(s,0,n-1) else "NO")
View View3DSpeckleBIMDemo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View temppath.cs
using System.IO;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using MessageBox = System.Windows.MessageBox;
namespace Test
{
[Transaction(TransactionMode.Manual)]
public class Lab : IExternalCommand
View CreateNewSweptBlend.cs
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
Autodesk.Revit.Creation.Application app = commandData.Application.Application.Create;
Document doc = commandData.Application.ActiveUIDocument.Document;
using (Transaction tran = new Transaction(doc, "Test"))
{
tran.Start();
//ElementId id = doc.GetElement(new ElementId(1)).Id;
CreateNewSweptBlend(commandData.Application.ActiveUIDocument.Document);
tran.Commit();
View githubdownload.cs
using System.Net;
using Octokit;
var client = new GitHubClient(new ProductHeaderValue("xxx"));
var releases = client.Repository.Release.GetAll("chuongmep", "revitaddinmanager");
var latest = releases.Result.First();
Console.WriteLine(
"The latest release is tagged at {0} and is named {1}",
latest.TagName,
latest.Name);
View support.cs
public override void Action()
{
Application.ActiveDocument.CurrentSelection.Changed += CurrentSelection_Changed;
}
public void CurrentSelection_Changed(object sender, EventArgs e)
{
var selection = Application.ActiveDocument.CurrentSelection;
MessageBox.Show(selection.SelectedItems.First.ClassDisplayName.ToString());
Application.ActiveDocument.CurrentSelection.Changed -= CurrentSelection_Changed;
View eventhander.cs
[Transaction(TransactionMode.Manual)]
public class test : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
commandData.Application.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>(OnDialogShowing);
commandData.Application.Application.FailuresProcessing += new EventHandler<FailuresProcessingEventArgs>(OnFailuresProcessing);
commandData.Application.Application.FailuresProcessing -= OnFailuresProcessing;
commandData.Application.DialogBoxShowing -= OnDialogShowing;
View snoop.cs
public static Dictionary<string, string> SnoopProperties(this object obj, bool isTraceDebug)
{
Dictionary<string, string> data = new Dictionary<string, string>();
Type type = obj.GetType();
foreach (PropertyInfo propertyInfo in type.GetProperties())
{
try
{
object value = propertyInfo.GetValue(obj);
if (!data.ContainsKey(propertyInfo.Name))