GeometryGym / GeometryGymIFC

C# classes to generate and parse OpenBIM IFC files
Other
282 stars 97 forks source link

Different FILE_NAME results #20

Open heatgithub opened 5 years ago

heatgithub commented 5 years ago

In my Class Library project, the FILE_NAME section in the header outputs organization as my computer manufactures name (HP) and the originating_system becomes 'GeometryGymIFC v0.0.19.0'.

But in my Console Application project, the organizations becomes 'Unknown' and the originating_system becomes my application name and version.

Why this difference and what can I do about it?

jmirtsch commented 5 years ago

Hi,

Can you reference some code (ie a github repo or similar) so I can can test this?

As for how these values are determined, refer to these parts of the code. https://github.com/GeometryGym/GeometryGymIFC/blob/WorkInProgress/Core/IFC/IFC%20O.cs See the registry key reference Microsoft.Win32.Registry.GetValue(@"HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization"

Note that it should ignore Microsoft and HP

Check the class FactoryIfc in https://github.com/GeometryGym/GeometryGymIFC/blob/WorkInProgress/Core/IFC/DatabaseIFC.cs

There are properties for Application, Person, Organization. Setters can be added to these to permit easier override when initializing the database.

The method getHeaderString within DatabaseIfc uses these when writing to file.

Cheers,

Jon

heatgithub commented 5 years ago

I put some code here: https://github.com/heatgithub/IFC_FileHeader_Examples (Note that the Class Library code is for AutoCAD)

My HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization says "Hewlett-Packard Company" so thats why it becomes HP. But I would like to be able to set the organization name in my code.

Setting db.Factory.ApplicationFullName will change the originating_system in FILE_NAME and also IFCAPPLICATION like: #19= IFCAPPLICATION(#20,'0.0.19.0','full-name-of-app','app-identification'); But it will still show your version number.

/Henrik

jmirtsch commented 5 years ago

Hi Henrik,

Here's an extraction of how to set the application that I've used for a client use of the toolkit. I do think a reference to the toolkit version is a good thing in the header.

Let me know if this helps or not.

Cheers,

Jon

DatabaseIfc db = new DatabaseIfc(true, ModelView.Ifc2x3Coordination); IfcOrganization organization = new IfcOrganization(db, "Acme Ltd.") { }; db.Factory.Application = new IfcApplication(organization, "1.0.0", "MyApplication", "MyApp");

heatgithub commented 5 years ago

Your toolkit is named under 'preprocessor_version', and that's ok.

The code above didn't changed anything in the header.

/Henrik

jmirtsch commented 5 years ago

Hi Henrik,

I see what you mean, I've just committed a change to WorkInProgress branch that will set the header application full name when setting the application to the factory. An alternative, you can explicitly nominate the property db.Factory.ApplicationFullName to achieve the string in the header you desire.

Cheers,

Jon

heatgithub commented 5 years ago

db.Factory.ApplicationFullName works. I'll wait for a new version to download from NuGet and then I will test the new changes.

/ Henrik

heatgithub commented 5 years ago

Tested your latest changes regarding IfcApplication and originating_system and I can confirm that setting db.Factory.ApplicationFullName do change originating_system.

Is it possible to get some similar change regarding IfcOrganization and organization in the FILE_NAME part of the header?

/ Henrik

heatgithub commented 4 years ago

I haven't been into this for some time now but I now saw that some changes were made to the IfcOrganization class about the organization string. But I still want to be able to set it myself like the Name string. I add this line and compile it myself but I wish something similar founds its way into your code so I only need to update it from NuGet and don't have to compile myself first and then add the dll to my code.

public string OrganizationName { get { return mOrganization; } set { mOrganization = value; } }