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 | |
import sys | |
import System | |
clr.AddReference("System.Numerics") | |
# | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
import Autodesk.DesignScript.Geometry as DS | |
#import Revit API |
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 | |
import sys | |
import System | |
clr.AddReference("System.Numerics") | |
# | |
clr.AddReference('System.Drawing') | |
clr.AddReference('System.Windows.Forms') | |
import System.Drawing | |
import System.Windows.Forms |
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 | |
import sys | |
import System | |
pf_path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFilesX86) | |
sys.path.append(pf_path + '\\IronPython 2.7\\Lib') | |
import os | |
import math | |
clr.AddReference('acmgd') | |
clr.AddReference('acdbmgd') | |
clr.AddReference('accoremgd') |
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
lena = 1200.0 | |
lenb = 1000 | |
lenc = 2000.5 | |
lend = 4000 | |
# | |
splitlen = 1200 | |
# | |
for curvLen in [lena,lenb,lenc,lend]: | |
quot, remain = divmod(curvLen, splitlen) | |
t = [x for x in [splitlen] * int(quot) + [remain] if x != 0 ] |
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 | |
import sys | |
import re | |
import System | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
import Autodesk.DesignScript.Geometry as DS | |
#import Revit API | |
clr.AddReference('RevitAPI') |
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 | |
import sys | |
import System | |
clr.AddReference('ProtoGeometry') | |
from Autodesk.DesignScript.Geometry import * | |
import Autodesk.DesignScript.Geometry as DS | |
#import Revit API | |
clr.AddReference('RevitAPI') | |
import Autodesk |
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(r'Microsoft.mshtml, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') | |
import mshtml | |
from mshtml import * | |
html_doc = """<html><head><title>The Dormouse's story</title></head> | |
<body> | |
<p class="title"><b>The Dormouse's story</b></p> | |
<p class="story">Once upon a time there were three little sisters; and their names were |
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
lst = ["car","blue","car","red"] | |
var = {xvalue:[idx for idx, value in enumerate(lst) if value == xvalue] for xvalue in set(lst)} | |
print var |
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
lst = [["A","B","C","D"], ["E","F","G","H"]] | |
replaceIndex = [[2, 3], [1, 2]] | |
replaceValue = [["C1", "D1"],["F1", "G1"]] | |
out = [] | |
for sublst, lstidx, lstrep in zip(lst, replaceIndex, replaceValue): | |
for idx, rep in zip(lstidx, lstrep): | |
sublst[idx]=rep | |
out.append(sublst) |
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
def seqatIndex(mainLst, lstB): | |
if len(lstB) > 0: | |
seq = lstB.pop(0) | |
valueToAdd = seq.pop(0) | |
for i , value_ in enumerate(mainLst): | |
if value_ == seq[0]: | |
mainLst.insert(i , valueToAdd) | |
return seqatIndex(mainLst, lstB) | |
else: |
NewerOlder