Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

chuongmep

💭
I may be slow to respond.
View GitHub Profile
View sortroomarea.cs
FilteredElementCollector Rooms = new FilteredElementCollector(xdoc);
temc.WherePasses(rmfilter).WhereElementIsNotElementType();
IOrderedEnumerable<Element> rooom =
Rooms.ToList().OrderBy(x => x.get_Parameter(BuiltInParameter.ROOM_AREA).AsDouble());
IEnumerable<Element> RoomSort = rooom.Reverse();
View sortbyZXY.py
import clr
input = IN[0]
result = []
def sortbyZXY(point):
point.sort(key = lambda points: (point.Z, point.X, point.Y))
return points
for i in input:
View NewRadialDimension.py
#Copyright(c) 2021, Hồ Văn Chương
# @chuongmep, https://chuongmep.com/
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
View NewRadialDimension.cs
var tran = new Transaction(DB.Doc);
tran.Start("s");
var extrusionRef = DB.UIApp.ActiveUIDocument.Selection.PickObject(
ObjectType.Element, "Select a circular extrusion: ");
var extr = DB.Doc.GetElement(extrusionRef.ElementId) as Extrusion;
var skt = extr.Sketch;
Arc arc = null;
foreach (CurveArray curArr in skt.Profile)
foreach (Curve curve in curArr)
{
View vi_no_phonology.cs
//https://www.jetbrains.com/help/resharper/Spell_Checking.html#configuring-respeller-inspections
void ex()
{
string path = @"D:\API\dictionaries\dictionaries\vi\index.dic";
string newpath = @"D:\API\dictionaries\dictionaries\vi\index2.dic";
string text = File.ReadAllText(path);
string newtext = RemoveSign4VietnameseString(text);
string[] lines = newtext.Split(
new[] { "\r\n", "\r", "\n" },
StringSplitOptions.None
View inserttag.py
from itertools import groupby, count
bol = [None, "2018",None,None,None,"2018","2019","2020",None,None]
value = "Data"
def get_bol(a):
index = []
for i in range(len(a)-1):
if isinstance(a[i], str):
index.append(i)
return index
def set_bol(a,intervals,value):
View GetElementConnectedContinuous.cs
public static List<Element> GetElementConnectedContinuous(this Element e)
{
Dictionary<string, Element> OutElements = new Dictionary<string, Element>();
List<Element> collector = Collector(e, OutElements);
return collector;
}
View ConnectedWith.cs
public static List<Element> GetElementConnectedWith(this Element e)
{
List<Element> elements = new List<Element>();
List<Connector> connectors = e.GetConnectors();
if (connectors == null) return elements;
if (connectors.Count == 0) return elements;
elements = GetElementConnectedWith(connectors);
return elements;
}
public static List<Element> GetElementConnectedWith(this List<Connector> connectors)