This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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",\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |