Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

The solution of the secondary development of Revit

Shulou Source: shulou.com Published: 2022-06-03 05:12:12 10月01日 Update

According to the current procedure, there are several improvements

1 after each revit generation, the log will not be del. The next time it is generated, if you find that there is a log, it will not be generated again. By changing the name of the log to a timestamp, an independent log file is generated each time it is run.

Sample code

String date = DateTime.Now.ToLongDateString () .ToString () + DateTime.Now.ToLongTimeString ()

Date = date.Replace (":", "_")

Roller.File = @ "EventLogByrevit" + date + ".txt"

This code is placed in log.cs. Execute in the command of revit. This method is useful when debugging.

2 in the Model class, add a library that drop the original each time, and regenerate a library separately.

Added to the constructor in the Model class

Database.SetInitializer (new DropCreateDatabaseAlways ())

3 add a time field to DB to see when the data was saved.

4 add a file name field to DB, which is the full-text file name, so when setting this property in the class, keep it about 1000 characters. Otherwise, some of them will be very long and will make a mistake when keeping them.

5 when maintaining, because there are more builds, download the build from the website

On the console of Negut, execute the following command

Install-Package Z.EntityFramework.Extensions-Version 3.22.6

An Extension is installed, which supports batch retention.

6 if the amount of data is still very large, then the data is divided into 10000 units. The method of dividing can be referred to.

List templist = new List (); int separate = 10000; int mod integers = count / separate; int mod remainder = count% separate; for (int j = 1; j

Tags: File data filename time log processing entity artifact generation code remainder integer method unit command place field plug-in data processing time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Information NVidia OPPO Reno Shulou Technology