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

Conceptual storing information

$
0
0

Hi forum. Revit API is my first approach to programming so I lack many basic knowledge. I want to store some information on Text Notes. As I cant add parameters to text notes, has occurred to me that I can use some text file in my addin folder to store this. This should be something like:

- create 1 text file in the addin folder for every project in which add is used. Every time document is saved as, text file is saved as with the same name to keep coordination.

- when needed, access to the file with the name of the project, and write or read it (kind of: "text note  - 535474 - parameter info")

 

Then doubts that come to my mind:

- How to handle if project´s name change in other pc.

- Is this use of txt files appropiate to what Im trying to achieve? There is any "better" or usual way?

- Should I identify every element through "element id" or through "unique-id". I think I can handle operations only with element id but im not sure. Worst case scenario should be that some lines with ids from deleted elements are keeped in the text file but I think thats not a big deal as element Ids are never going to be overrided.

 

As you see this is not an specific doubt but a little topic about how to process in programming with this kind of folder structure. Regards.

 


Re: Getting parameters assigned to a label

$
0
0

Hi Jeremy,

 

Thanks for the prompt reply!   

 

The problem is that I can't get (or don't know how to get) the actual parameter object.  In Revit Lookup, following the Label parameter of the TextElement leads to what appears to be a dead end.

 

image.png

Re: Retrieve current folder path

$
0
0

On the application object there are properties you can make use of:

 

Application.AllUsersAddinsLocation

Typically: C:\ProgramData\Autodesk\Revit\Addins\<Year>

Application.CurrentUserAddinsLocation

Typically: C:\Users\<User>\AppData\Roaming\Autodesk\Revit\Addins\<Year>

 

It is a bad idea to hardcode parts of a path as in different environments the locations may not be as expected. In virtualised environment for example.

 

 

Re: Getting parameters assigned to a label

$
0
0

As far as I know this is still not possible. I've long ago categorised it under 'you'd think it would be easy but is actually impossible.'

 

I believe the SharedParameterElement objects you get in a family are typically those used as parameters and not necessarily those used in a label. 

Re: Conceptual storing information

$
0
0

Should look up extensible storage as a method of adding data to elements. Some categories of element can't have parameters attached.

 

I don't control how UniqueIds behave so I'd be inclined to create my own with a GUID. Storing such things in the project using a DataStorage item or a text element itself is the same concept. So you identify the project and then the element within the project.

Re: Entitlement API makes a purchase by a firm...impossible?

$
0
0

After looking at the terms of use on the App Store, it's not clear to me if subscriptions are automatically renewed (debited from your bank account) on purchases from the app store.  Does anyone know?

 

If not automatically renewed, I can relax if an app subscription is lost or forgotten.

Re: Retrieve current folder path

$
0
0

Try using:

 

using System.Reflection;

string thisAssemblyPath =    Assembly.GetExecutingAssembly().Location;

 

Or for a macro, try:

string thisAssemblyPath = this.AddinFolder.ToString();

Re: Conceptual storing information

$
0
0

Looks like I was reinventing the wheel. Extensible storage seems to be the concept I was looking for and didnt knew. Im gonna give it a deep look. Thanks!


Re: Getting parameters assigned to a label

$
0
0

Wow. Shocking. I certainly hope a wish has been raised for this in the Revit Idea Station, at least.

 

Re: Retrieve current folder path

Re: Getting parameters assigned to a label

Re: Retrieve current folder path

$
0
0

You can get application as follows:

 

From IExternalCommand.Execute:

commandData.Application.Application

 

From IExternalApplication.OnStartUp/OnShutDown

application.ControlledApplication

 

From IExternalDBApplication.OnStartUp/OnShutDown

application

 

has probably given a more precise answer since it will list the location of your executing dll file (this can be elsewhere from the .addin file). Note also difference between .GetExecutingAssembly and .GetCallingAssembly.

 

Re: Modify Model Lines of an Existing Floor Slab

$
0
0

You can make some basic changes to the underlying model lines within the sketch. I've recently used ElementTransformUtils.MoveElement successfully to offset a line. Probably the key is to ensure that the sketch remains joined up (when you move a line in the UI it drags the other joined lines with it). It may be possible to directly alter the geometry curve of a model line if you've ensured all the lines you are changing still join. I've not tested this and it would depend on when the check for a joined up sketch is undertaken (ideally upon transaction commit). You can only change one curve at a time and in the UI this is dealt with via a sketching context but in the API you just have model line elements.

 

So when you commit changes does it review the overall picture of the sketch or the changes of each model line in turn. If the commit looks at each model line change in turn (in relation to it's existing neighbours) then there will be a point where the new line information doesn't join with the existing line information (not yet updated). 

Show all members of a family catalog in table form

$
0
0

Hello, I am just starting to learn Revit and am hoping someone could prod me in the right direction. As stated in the title I am looking to develop a plug-in to display all info for a given family file. So far I have looked at making a schedule to display the information and also at the table library in the Revit API. I get the feeling that schedules are designed more for displaying project information. What would be my best approach? Thanks. 

Re: Getting parameters assigned to a label

$
0
0

Hi  

Thanks for creating the idea! I came up against this a long while back.

Hi  

The thought that reading these latest posts brought up was that there's a possible (terrible!) workaround.

Create a dud model, create an instance of the thing to be tagged, tag it with your family, set the parameters of the instance to unique values, then read the tag's TagText value, and decipher it.

 

I told you it was terrible.


Re: Retrieve current folder path

$
0
0

Thanks for the clarification. 

 

Regards

Where can i find the SDK documentation?

$
0
0

Does annyone knows where can i find the SDK for REVIT 2021 and the documentation?

Re: Where can i find the SDK documentation?

Re: Where can i find the SDK documentation?

Re: Update the views

$
0
0

Let's say that you have 2 views open (in the same document), A and B. And you zoom A, and you want the view B to follow.

Idling event is always being triggered once the Revit is not busy (not rendering, no mouse or keyboard actions).

https://thebuildingcoder.typepad.com/blog/2012/04/idling-enhancements-and-external-events.html 

 

Here is a topic about Idling event from Jeremy's blog. You might also wanna check the SDK sample project ModelessForm_IdlingEvent.csproj

 

If you have already implemented an external command : Use UIView.ZoomAndCenterRectangle() to make B following A.

Then all you have to do is to copy your codes into Idling event.

Viewing all 66694 articles
Browse latest View live