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

Re: Tag Width/Height or Accurate BoundingBox of IndependentTag

$
0
0

Following is my code to get the IndependentTag width by creating a new tag in the center of the reference. Needs some work but seems to work OK.

I was using this to left justify a selection of tags, however I cannot work out how to move the original tag from the TagHeadPosition to the selected point, less half the width using this function.

 

Public Shared Function GetIndependentTagWidth(ByVal objIndependentTag As IndependentTag) As Double
        Dim dblWidth As Double = 0
        Try
            Dim objDocument As Document = objIndependentTag.Document
            Dim objActiveView As View = objDocument.ActiveView
            Using transGroup As New TransactionGroup(objDocument)
                transGroup.Start("Transaction Group")
                Using firstTrans As New Transaction(objDocument)
                    Dim objReference As Reference = objIndependentTag.GetTaggedReference
                    Dim objBoundingBoxXYZ As BoundingBoxXYZ = objDocument.GetElement(objReference.ElementId).BoundingBox(objActiveView)
                    Dim boundingBoxMaxX As Double = objBoundingBoxXYZ.Max.X
                    Dim boundingBoxMaxY As Double = objBoundingBoxXYZ.Max.Y
                    Dim boundingBoxMinX As Double = objBoundingBoxXYZ.Min.X
                    Dim boundingBoxMinY As Double = objBoundingBoxXYZ.Min.Y
                    Dim elementXYZ As New XYZ(boundingBoxMaxX - ((boundingBoxMaxX - boundingBoxMinX) / 2), boundingBoxMaxY - ((boundingBoxMaxY - boundingBoxMinY) / 2), 0)
                    firstTrans.Start("First Transaction")
                    Dim objNewIndependentTag As IndependentTag = IndependentTag.Create(
                        objDocument, objActiveView.Id, objIndependentTag.GetTaggedReference,
                        False, TagMode.TM_ADDBY_CATEGORY, objIndependentTag.TagOrientation, elementXYZ)
                    objBoundingBoxXYZ = objNewIndependentTag.BoundingBox(objActiveView)
                    boundingBoxMaxX = objBoundingBoxXYZ.Max.X
                    boundingBoxMinX = objBoundingBoxXYZ.Min.X
                    dblWidth = boundingBoxMaxX - boundingBoxMinX
                    objIndependentTag.HasLeader = False
                    firstTrans.Commit()
                    objBoundingBoxXYZ = objIndependentTag.BoundingBox(objActiveView)
                End Using
                transGroup.RollBack()
            End Using
        Catch ex As Exception
            Msgbox(ex.message)
        End Try
        Return dblWidth
    End Function

Kind Regards

David


Revit Namespace and Autodesk.Geometry Namespace documentation

$
0
0

Hi Guys,

 

is there any available documentation for the Revit namespace and the Autodesk namespace? similar to the Revit API documentation online?

 

Thanks

Re: Central Model

$
0
0

Thank you for the responces.

As I understand it and my initial tests would  lead me to believe this is correct, that utilising:

 

BasicFileInfo.Extract(file path for Local Model).AllLocalChangesSavedToCentral always returns true when utilised on the Central Model. This does however return the appropriate true or false result when utilised on the LocalModel.

 

As for "HasAllChangesFromCentral" and "SynchronizeWithCentralOptions"  these again are for utilisation on the LocalModel.

 

I am leaning towards the fact that the only solution available is to create a local model and check if each element is borrowed. The down side to this is how resource intensive the process can be.

 

The most efficient solution I believe would be if the central model  could some how store the location of the Local Models so that BasicFileInfo.Extract(file path for Local Model).AllLocalChangesSavedToCentral could be utilised.

 

Again, thankyou for your responses.

 

Re: Revit Namespace and Autodesk.Geometry Namespace documentation

$
0
0

Hi  ,

What do you mean by Autodesk namespace?

could you please explain in detail what you are looking for?

I suggest that you, first of all, take a look at the getting started material and work through the step-by-step instructions provided by My First Revit Plugin 

https://knowledge.autodesk.com/support/revit-products/learn-explore/caas/simplecontent/content/my-first-revit-plug-overview.html

 

 and here some of the links that could help you to understand namespace

https://thebuildingcoder.typepad.com/blog/2009/10/namespaces.html 

https://thebuildingcoder.typepad.com/blog/2008/12/using-namespaces.html 

 

Re: ElementTransformUtils.RotateElement is not working

$
0
0

It looks like that this is a bug. I had a similar problem with only one Elevation Mark that won't rotate to the angle that I am setting. My approach was to do the rotation in a separate transaction. So in the first Transaction create the elevation mark and at least one elevation (otherwise you can't rotate the elevation mark). Then in the second transaction do the rotation.

Re: Tag Width/Height or Accurate BoundingBox of IndependentTag

$
0
0

Dear David,

 

Thank you for the cool idea and efficient solution. Yet another example of the temporary transaction trick.

 

Two questions:

 

I suppose you could also omit the transaction group, and just use the naked, unwrapped, transaction directly for this purpose?

 

Could you possibly also omit the creation of a new tag, and just set HasLeader to false on the original tag within the temporary transaction instead?

 

You ask, how to move the original tag from the TagHeadPosition to the selected point, less half the width.

 

It might be very simple. Does this discussion answer your question?

 

https://thebuildingcoder.typepad.com/blog/2013/10/move-tag-to-host-location.html

 

Re: ElementTransformUtils.RotateElement is not working

Re: ElementTransformUtils.RotateElement is not working

$
0
0

I will check it an let you know, thank you!

 

EDIT: Yes, I guess is the same problem mentioned in the links. I tried to rotate it twice with half the angle and it is working as expected. So until there is solution we will work with the workarounds. Thank you for sharing the right workflow!


Re: Revit Event hander when activeUIDocument changed to another activeUIdocument

Re: Revit Namespace and Autodesk.Geometry Namespace documentation

$
0
0

Just open them up in Visual Studio and take a look for yourself.

 

The contents of the Autodesk namespace depend on what API assemblies you have loaded.

 

If you have loaded only the Revit API assemblies, then probably the Revit namespace is the only thing contained in the Autodesk one.

 

Why is heavens name are you asking this?

 

What do you wish to achieve?

 

Re: IUpdater in a project macro on startup

$
0
0

Thank you very much for your perseverance, successful research and sharing the solution.

 

I am preparing a blog post from it, if I may.

 

You say, my version currently works for columns and beams, but not for walls.

 

Well, you have implemented something called a FamilyInstanceUpdater, you say.

 

Beams and columns are family instances, and walls are not.

 

That sounds like a probable cause to me.

 

You can probably expend your FamilyInstanceUpdater to include Wall objects as well as FamilyInstance objects.

 

If you do so, please rename it appropriately, for your own sanity's sake.

 

Re: IUpdater in a project macro on startup

$
0
0

For instance, you might change the name and definition of `familyInstanceFilter` from `new ElementClassFilter( typeof( FamilyInstance ) )` to something like this:

 

  ElementFilter f = new LogicalOrFilter(
    new ElementClassFilter(typeof(FamilyInstance)),
    new ElementClassFilter(typeof(Wall));

  

Cheers,

 

Jeremy

 

Re: ElementTransformUtils.RotateElement is not working

$
0
0

I think we have the same issue. And I think it is the reason why we use only Revit 2018 and further (because I think the bug has been fixed in 2018)

Re: ElementTransformUtils.RotateElement is not working

$
0
0

My issues are with Revit 2019.2, so I don't think that the issue is resolved. Of course, I may have a different problem but it looks like it is the same.

 

ADDED: From my tests so far the problem is with only with angles close to 180, so 180 and a little bit less than 180 and a little bit more than 180 = )

Re: IUpdater in a project macro on startup


Re: Move title of a viewport

$
0
0

Its not clever but as work around you can;

  • Get viewport's view
  • Halve view's size in x direction to the right
  • Remove viewport and then replace, (title now at left of half size VP).
  • Reset size of view to original, title remain in place

It would be good if the API had a method.  Mine is a very "messy" workaround.

How do I get parameters from the children of a family

$
0
0

Hi,

 

For a client of ours we are creating a plugin to calculate prices based on prefabricated windows / window-frames. The client will provide us with these windows. 

 

Right now we can drop a prefab-window into revit and it renders and places just like we want it to, but we are experiencing a blocking factor;

 

Right now we need to want to start the price calculation, or at least the preparation towards it, but for this we need to get certain parameters of the prefab-window's family. This is proving to be a bit of a problem right now...

 

Does any of you have a solution for this problem using Revit API 2018 and above?

Re: Dimension on Hatch Pattern Slab

$
0
0

, I'd like to thank you for the innovative approach, infinity likes.

This works in a very cool way with dimensions, I also had a thought, I think we can use this approach to align the model pattern, by moving the floor itself, then adjusting its sketch. All by knowing the dimension position from the Dimension.Segments.

 

 

 

 

Re: How do I get parameters from the children of a family

$
0
0

Are you asking how to find child family instances, given the parent family instance, or are you asking how to obtain parameter values from a family instance?

Re: How do I get parameters from the children of a family

$
0
0

I am indeed looking for child family instances, given the parent family instance.

 

Thanks for your quick reply!

Viewing all 66666 articles
Browse latest View live


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