Quantcast
Channel: All Revit API Forum posts
Viewing all 66746 articles
Browse latest View live

Re: Exterior wall face normal changes if the wall curve direction changes.

$
0
0

Hi Jeremy, 

I am trying to implement this but, every time I am getting "Exception: Modification of the document is forbidden."

 

I am starting a transaction.

 

    c = LocationCurve
    c = selected.Location.Curve
    t = Transaction(doc, "Reverse Wall Direction")
    t.Start()
    selected.Location.Curve = c.CreateReversed()
    t.Commit()

Any idea why?

 


Re: Sometimes  Use Rebar API SetHookOritentation methond is invalid

Visual Studio for c# Revit API

$
0
0

Hello,

 

I have a question with the visual studio addin from Jeremy Tammik https://thebuildingcoder.typepad.com/blog/2017/04/revit-2018-visual-studio-c-and-vb-net-add-in-wizards.html

Very useful tool, but a program does not run on my computer. I am getting the message: The application is in break mode:Your app has entered a break state, but no code is currently executing that is supported by the selected debug engine (e.g. only native runtime code is executing).

I have VS 2017 and Revit 2019. I have switched to 64x but it didnt help. Does anybody have any clues? Thanks!

Re: Can't Solve Rebar Shape

$
0
0

can you describe you process of copying rebar in more detail?

If you only want to copy a rebar, I think ElementTransformUtils.CopyElement() is enough and it should not create any error at all. This method requires an existing rebar/ rebars as input.

Back to the problem you are facing, this error can occur due to many problems. In my humble experience, it might be that  you didn't not use the mentioned method but try to create a rebar shape/ rebar from curves and the curves are not valid. May be the segment length/ parameters are negative/ zero due to calculation process, may be the rebar shape is not multi planar but do not reside on a plane, may be the normal vector is incorrect....

All these thing can make the rebar shape for the copied rebar can not be resolved.

 

Re: Is a model Workshared without opening the file

$
0
0

Perfect thank you,

I still need to dig through the Revit.ini file for the local folder. But I don't think there is currently any API for that.

 

Kind Regards

David

 

Re: Exterior wall face normal changes if the wall curve direction changes.

$
0
0

Maybe your document is read-only.

 

Maybe your transaction mode is read-only.

 

Can you perform the required modification manually in the user interface?

 

Re: Filter elements by parameter value

$
0
0

Please learn more about .NET and LINQ before trying to put together such a complex statement in one single line.

 

Your question has nothing to do with the Revit API. 

 

It is a pure .NET issue.

 

It will probably simplify things for you if you split that statement into several separate smaller ones, and understand their purpose one by one.

 

It looks as if you are casting the results of the filtered element collector to a list of `Family` objects.

 

The result of that cast is an `IEnumerable<Autodesk.Revit.DB.Family>`.

 

That cannot be converted to a `FilteredElementCollector`.

 

Hence an error message.

 

However, I do not see how the statement that you share could cause the exact error message that you show.

 

Re: Drive Geometry with "INSTANCE_SILL_HEIGHT_PARAM" in window and doo

$
0
0

Dear Jeremy,

 

Thank you for your quick answer and you help.

 

"Are you asking whether you can set the value of that parameter on a selected family instance after it has been inserted into the BIM project?"

 

No, I didn't express clearly what I wanted to do exactly, hope my Sketch and the following explanation will be more clear:

 

Each instance of a window family adoptes a different value following the value entered in the window properties parameter "Sill Heigt". This value for each instance seems to be stored in the internal parameter "INSTANCE_SILL_HEIGHT_PARAM". My goal is to acces this value in the window family and to drive geometry with this parameter. This geometry, once inserted in the project would adopt the dimension according to value stored in "INSTANCE_SILL_HEIGHT_PARAM".

Although there seems to be no way to acces this parameter in a window family to allocate to a dimension, that is why I hoped there would be a possibility trough Revit API.

INSTANCE_SILL_HEIGHT_PARAM_3.jpg

Best regards,

Jakob


Re: Visual Studio for c# Revit API

$
0
0

Please work through the Revit API getting started material before trying to make use of the Visual Studio Revit add-in wizard, which is in fact more a template than a wizard:

 

https://github.com/jeremytammik/VisualStudioRevitAddinWizard

 

The template does nothing but automate a few steps for you when creating a new Revit add-in.

 

It is important to understand what the steps are and why they are needed in order to fix it if anything goes wrong.

 

This basic understanding is provided by the getting stared material and the tutorials it points to:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

Re: Flip Pipe Fitting

Re: Drive Geometry with "INSTANCE_SILL_HEIGHT_PARAM" in window and doo

$
0
0

I am certain this can be achieved.

 

There is certainly some property in the family that corresponds to the sill height, and you can determine that property value, probably manually as well as programmatically.

 

Look at The Building Coder discussion on the Family API, especially the ones that deal with creating a family definition:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.25

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.25.1

 

One method that comes to mind is the AssociateElementParameterToFamilyParameter method:

 

https://www.revitapidocs.com/2020/a047ea58-0351-b419-d856-85ed23734ee8.htm

 

However, this method does have a corresponding functionality in the user interface.

 

You can hardly ever achieve anything using the Revit API that is not possible in the UI as well.

 

Re: Duct system

$
0
0

It's only that I have trouble understanding:


Pipingsystem falls below the Plumbing category so to create a system it is:
SystemPipe = Plumbing.PipingSystemType.Create(Doc, MEPSystemClassification.OtherPipe, "SystemPipe")

 

Normally for Duct falls below the Mechanical category so to create a system it is:
SystemDuct = Mechanical.DuctSystemType.Create(Doc, MEPSystemClassification.OtherAir, "SystemDuct")

 

But for some reason that I do not understand yet, it does not work for the duct system!

Re: Filter elements by parameter value

$
0
0

Hi Jeremy.

Thank you very much for your attention, and direction where to learn further.

I was making in hurry a script on previous weak and when got to this problem I solved it by additional check (model category type) while processing the collector. So the question is more about what to learn and my pleasure to get the answer from you.

However, I will try not to forget to place here the solution post upon realizing the reason of my problem.

 

How to know if family cuts?

$
0
0

Id like to say this guy cuts, am i right?

this family cutss..

internal static bool VerifyFamilyIsCutting(Document famdoc) => famdoc.OwnerFamily.get_Parameter(BuiltInParameter.FAMILY_ALLOW_CUT_WITH_VOIDS).AsInteger() == 1? true : false;

Re: Get host geometry in family document

$
0
0

Hi,

Did this work as how do you differentiate nbetween a family document with no host so you dont accidently hide the first extrusion for a fmaily that doesnt have a host extrusion.?


Possible bug in FilterStringRule

$
0
0

Hey. I found a strange bug in RevitAPI. When creating a FilterStringRule rule, I specify that the comparison should not be case sensitive (caseSensitive: false). But the comparison is done with case sensitivity. I put it in a separate code, where there is nothing else, and checked. Any ideas?

 

[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)

{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Application app = uiapp.Application;
Document doc = uidoc.Document;

 

ParameterValueProvider pvp = new ParameterValueProvider(new ElementId(1236953));

FilterStringRule rule = new FilterStringRule(pvp, new FilterStringContains(), "вчшг", caseSensitive: false);

Element elem = doc.GetElement(new ElementId(1664890));
Parameter p = elem.GetParameters("Наименование").FirstOrDefault();

 

Debug.Print($"parameter value: '{p.AsString()}'");
Debug.Print($"check: {rule.ElementPasses(elem)}");

 

// Output message:
// parameter value: 'Труба чугунная напорная ВЧШГ 150 мм'
// check: False

return Result.Succeeded;
}
}

Re: Exterior wall face normal changes if the wall curve direction changes.

$
0
0

Hi Jeremy, I can indeed manually move the wall, change its profile and manually drag and drop its endpoints.

I don't know how I would go about reversing the wall location curve direction using the interface.

All the other add-ins I have that perform transactions work just fine as well.

Capture.PNG

That's what the UI shows if the wall is connected to other walls.

 

If I run Document.IsModified before trying to modify the transaction it returns TRUE.

this is the complete error message:

 

Script Executor Traceback: Autodesk.Revit.Exceptions.InvalidOperationException: Modification of the document is forbidden. Typically, this is because there is no open transaction; consult documentation for Document.IsModified for other possible causes. at Autodesk.Revit.DB.Document.Regenerate() at Microsoft.Scripting.Interpreter.ActionCallInstruction`1.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run3[T0,T1,T2,TRet](T0 arg0, T1 arg1, T2 arg2) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at Microsoft.Scripting.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1) at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx) at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)

 

Re: Possible bug in FilterStringRule

Re: How to get correct Transform of Family Instance?

$
0
0

Afaik, the Revit SDK sample ElementViewer displays geometry for all elements correctly under all circumstances.

 

It also demonstrates how to obtain the correct geometry transformation for family instances.

 

Can you try it out with your mirrored elements, please?

 

If it displays them incorrectly, please submit a minimal reproducible case for me to pass on to the development team for analysis:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#1b

 

Thank you!

 

How to use "import Autodesk.Revit.DB"

$
0
0

So I want to be able to use the Revit libraries in my Python code but I can't figure how to set up the Autodesk.Revit.DB module. Currently when I try and run "import Autodesk.Revit.DB" I get an error from python saying there is no module named Autodesk found.

 

I know in C# you can use visual studio to add references and then add the RevitAPI.dll but I don't know how to code in C#.. so if anyone could please help me out in how to use the Revit API in Python, thank you.

Viewing all 66746 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>