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 ActiveViewDynamo.py
#Copyright(c) 2016, Dimitar Venkov
# @5devene, dimitar.ven@gmail.com
import clr
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("RevitNodes")
View Convert3DTo2D.cs
public static string Convert3DTo2D(Revit.Elements.Views.View view, List<Element> GridorLevel)
{
Document doc = DocumentManager.Instance.CurrentDBDocument;
View v = view.InternalElement as View;
TransactionManager.Instance.EnsureInTransaction(doc);
List<DatumPlane> planes = GridorLevel.Select(x => x.InternalElement).Cast<DatumPlane>().ToList();
foreach (DatumPlane datumPlane in planes)
{
datumPlane.SetDatumExtentType(DatumEnds.End0, v, DatumExtentType.ViewSpecific);
datumPlane.SetDatumExtentType(DatumEnds.End1, v, DatumExtentType.ViewSpecific);
View Convert3DTo2D.py
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
View TypeNameSpace.py
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
import System.Reflection
import System.AppDomain
View splitstring.py
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
def GetName(item):
unwrapped = UnwrapElement(item)
if not unwrapped: return None
elif unwrapped.GetType().ToString() in ("Autodesk.Revit.DB.BuiltInParameter", \
"Autodesk.Revit.DB.BuiltInParameterGroup", "Autodesk.Revit.DB.DisplayUnitType",\
"Autodesk.Revit.DB.ParameterType", "Autodesk.Revit.DB.UnitSymbolType",\
View docx.snippet
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>docx</Title>
<Shortcut>docx</Shortcut>
<Description>Code snippet for contructor document</Description>
<Author>Chuong.Ho</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
View DotProduct.cs
/// <summary>
/// Return DotProduct of two Vector
/// </summary>
/// <param name="vector"></param>
/// <param name="other"></param>
/// <returns></returns>
public static double Dot(Autodesk.DesignScript.Geometry.Vector vector,
Autodesk.DesignScript.Geometry.Vector other)
{
return vector.X * other.X + vector.Y * other.Y + vector.Z * other.Z;
View CrossProduct.cs
/// <summary>
/// Cross Product Vector
/// </summary>
/// <param name="vector"></param>
/// <param name="other"></param>
/// <returns></returns>
public static Autodesk.DesignScript.Geometry.Vector Cross(Autodesk.DesignScript.Geometry.Vector vector,
Autodesk.DesignScript.Geometry.Vector other)
{
var x = vector.Y * other.Z - vector.Z * other.Y;
View MedianPoint.cs
XYZ MedianPoint( MeshTriangle triangle )
{
XYZ p = XYZ.Zero;
p += triangle.get_Vertex( 0 );
p += triangle.get_Vertex( 1 );
p += triangle.get_Vertex( 2 );
p *= 0.3333333333333333;
return p;
}
View MedianPoint.cs
XYZ MedianPoint( MeshTriangle triangle )
{
XYZ p = XYZ.Zero;
p += triangle.get_Vertex( 0 );
p += triangle.get_Vertex( 1 );
p += triangle.get_Vertex( 2 );
p *= 0.3333333333333333;
return p;
}