DynamoDS / DynamoRevit

Dynamo Libraries for Revit
https://dynamobim.org
328 stars 184 forks source link

Element.SetParameterByName Beams . z Justification #3020

Open Alexwanderwenzel opened 6 months ago

Alexwanderwenzel commented 6 months ago

Issue Description

Please fill in the following information to help us reproduce the issue:

Dynamo version

Dynamo: 2.13.1.3887

Operating system

OS: Microsoft Windows NT 10.0.19045.0

What did you do?

I was trying to change the z Justification in a Beam using the "Element.SetParameterByName" method (I tried both Dynamo modules and Python) and I get this error Element.SetParameterByName Operation Failed. specTypeId is not a measurableSpec (ForgetypeId). Parameter name: specTypeId

What did you expect to see?

A change in the z Justification. In previous versions of Revit that method and the z Justification parameter works fine.

What did you see instead?

(Fill in here)

What packages or external references (if any) were used?

Stack Trace

(From the Dynamo crash window select 'Details' -> 'Copy' and paste here)

image


CLR: 4.0.30319.42000

Alexwanderwenzel commented 6 months ago

import clr #This is .NET's Common Language Runtime. It's an execution environment

that is able to execute code from several different languages.

import sys #sys is a fundamental Python library - here, we're using it to load in

the standard IronPython libraries

sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib') #Imports the

standard IronPython libraries, which cover everything from servers and

encryption through to regular expressions.

import System #The System namespace at the root of .NET from System import Array #.NET class for handling array information from System.Collections.Generic import * #Lets you handle generics. Revit's API

sometimes wants hard-typed 'generic' lists, called ILists. If you don't need

these you can delete this line.

clr.AddReference('ProtoGeometry') #A Dynamo library for its proxy geometry

classes. You'll only need this if you're interacting with geometry.

from Autodesk.DesignScript.Geometry import * #Loads everything in Dynamo's

geometry library

clr.AddReference("RevitNodes") #Dynamo's nodes for Revit

import Revit #Loads in the Revit namespace in RevitNodes clr.ImportExtensions(Revit.Elements) #More loading of Dynamo's Revit libraries clr.ImportExtensions(Revit.GeometryConversion) #More loading of Dynamo's

Revit libraries. You'll only need this if you're interacting with geometry.

clr.AddReference("RevitServices") #Dynamo's classes for handling Revit documents import RevitServices from RevitServices.Persistence import DocumentManager #An internal Dynamo class

that keeps track of the document that Dynamo is currently attached to

from RevitServices.Transactions import TransactionManager #A Dynamo class for

opening and closing transactions to change the Revit document's database

clr.AddReference("RevitAPI") #Adding reference to Revit's API DLLs clr.AddReference("RevitAPIUI") #Adding reference to Revit's API DLLs

import Autodesk #Loads the Autodesk namespace from Autodesk.Revit.DB import #Loading Revit's API classes from Autodesk.Revit.UI import #Loading Revit's API UI classes

doc = DocumentManager.Instance.CurrentDBDocument #Finally, setting up handles to the active Revit document uiapp = DocumentManager.Instance.CurrentUIApplication #Setting a handle to the active Revit UI document app = uiapp.Application #Setting a handle to the currently-open instance of the Revit application uidoc = uiapp.ActiveUIDocument #Setting a handle to the currently-open instance of the Revit UI application Viga=IN[0] #######OK NOW YOU CAN CODE######## TransactionManager.Instance.EnsureInTransaction(doc)

Viga.SetParameterByName("z Justification", 2)

TransactionManager.Instance.TransactionTaskDone()

Alexwanderwenzel commented 6 months ago

SOLVED: in a 2022 Post

https://github.com/DynamoDS/DynamoRevit/issues/2845