- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Does anyone know how I would be able, through scripting, stretch Hanger Rods a specific length based on the Rod Size? If anyone can help please let me know.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
LFM.VDC-
So i dont know how your itms are set up but here is the script we use to stretch our hanger rods to the soffit write the service abbreviation into a field that can be added to a worksheet and also transform its elevation to a field for a label. It should give you an idea of how to accomplish this. Let me know if you have any questions on the script below
Requires Task.Selection
REM ******************************************************************************
REM * SCOPE: Drawing Database *
REM * DESCRIPTION: Copy item(s) Elavation to another field, move hanger top to *
REM * Soffit Elevation, Copy Service to another field *
REM * *
REM * PROPERTIES: JobItem.EndLocation(Bottom) *
Rem * JobItem.EndLocation(Top) *
REM * JobItem.Level *
REM * JobItem.Service *
REM * JobItem.ServiceType *
REM * JobItem.CustomData[8] *
REM * JobItem.CustomData[2] *
REM * JobItem.CustomData[7] *
REM * JobItem.Dim["Rod Extn Above"] *
REM * JobItem.Dim["Top Length"] *
REM * *
REM *----------------------------------------------------------------------------*
REM * CREATED BY: N.Chapman - GHAC/Madison *
REM * DIRECT: (608) 268-3116 *
REM * CELL: (608) 212-3464 *
REM * EMAIL: nchapman@generalheating.com *
REM * DATE: 5-6-2016 *
REM * REVISED BY: *
REM * REVISED Reason: *
REM * DIRECT: (xxx) xxx-xxxx *
REM * CELL: (xxx) xxx-xxxx *
REM * EMAIL: <user>@generalheating.com *
REM * DATE: mm-dd-yyyy *
REM ******************************************************************************
Dim Quote = ASCII(34)
Dim Ft = ASCII(39)
Dim Cr = ASCII(10)
Dim SectionElev
Dim CurrentElev
Dim Delta
Dim Loop = 1
While Loop <= Task.Selection.Count
Dim JobItem = Task.Selection[Loop]
SectionElev = JobItem.Level("soffit")
CurrentElev = JobItem.EndLocation(2,"top")
Delta = SectionElev - CurrentElev
If JobItem.ServiceType = "Hanger" And SectionElev > 0 Then
JobItem.Dim[7].Value = JobItem.Dim[7].Value + Delta
ElseIf JobItem.ServiceType = "Round hanger" And SectionElev > 0 Then
JobItem.Dim["Rod Extn Above"].Value = JobItem.Dim["Rod Extn Above"].Value + Delta
ElseIf JobItem.ServiceType = "Strap Hanger" And SectionElev > 0 Then
JobItem.Dim["Top Length"].Value = JobItem.Dim["Top Length"].Value + Delta
EndIf
Dim SBtm = JobItem.EndLocation(1,"Btm")
Dim SAb = JobItem.Service
Dim Len1 = Len(SBtm)
Dim Len2 = Len(SAb)
Dim Pt = InStr(1,SBtm,".")
Dim Pt1 = InStr(1,SAb,":")
Pt = Pt - 1
Pt1 = Pt1 + 1
Dim GetFrac = Right(SBtm,(Len1 - Pt))
Dim GetServ = Right(SAb,(Len2 - Pt1))
Dim Inch = Left(SBtm,Pt)
Dim Frac = 0
Dim GetFeet = Number(Inch) / 12
Dim Feet = RoundDown(GetFeet)
Dim DecInch = (GetFeet - Feet) * 12
If (Wildcard(GetServ, "*Chilled Water Return*")=1) Then
GetServ = "CHWR"
ElseIf (Wildcard(GetServ, "*Chilled Water Supply*")=1) Then
GetServ = "CHWS"
ElseIf (Wildcard(GetServ, "*Condensor Water Return*")=1) Then
GetServ = "CWR"
ElseIf (Wildcard(GetServ, "*Condensor Water Supply*")=1) Then
GetServ = "CWS"
ElseIf (Wildcard(GetServ, "*Hot Water Return*")=1) Then
GetServ = "HHWR"
ElseIf (Wildcard(GetServ, "*Hot Water Supply*")=1) Then
GetServ = "HHWS"
ElseIf (Wildcard(GetServ, "*Snow Melt Water Return*")=1) Then
GetServ = "SMWR"
ElseIf (Wildcard(GetServ, "*Snow Melt Water Supply*")=1) Then
GetServ = "SMWS"
EndIf
If GetFrac < .9375 Then
Select Number(GetFrac)
Case > .8124
Frac = "7/8"
Case > .6874
Frac = "3/4"
Case > .5624
Frac = "5/8"
Case > .4374
Frac = "1/2"
Case > .3124
Frac = "3/8"
Case > .1874
Frac = "1/4"
Case > .0624
Frac = "1/8"
Case > .9374
Frac = ""
Inch = Inch + 1
End Select
End If
Dim BtmElev
If Feet > 0 And Frac > 0 Then
BtmElev = Feet + Ft + "-" + DecInch + " " + Frac + Quote
ElseIf Feet > 0 Then
BtmElev = Feet + Ft + "-" + DecInch + Quote
Else
BtmElev = DecInch + " " + Frac + Quote
End If
JobItem.CustomData[8].Value = BtmElev
JobItem.CustomData[2].Value = GetServ
Loop = Loop + 1
EndWhile
Production Manager at General Heating and Air Conditioning
Revit Architecture Certified Professional
Revit MEP Mechanical Certified Professional
Revit MEP Electrical Certified Professional
DynaFabrication Package Author
Was this answer helpful? If so, please click the ACCEPT AS SOLUTION or the KUDOS button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Nathan,
I just seen this response from you, thank you very much it is very useful, I will study it and try to get it to work for me, will keep in touch for any help .