OSArch Community

BlenderBIM Experimental IFC Git add-on

  1. B

    @Coen I fixed this one a couple.of days ago, so it won't do this if you install the latest BlenderBIM.

    ..but it is only a message saying that ifcmerge didn't have anything to do. Either you were merging a branch into itself, or you were merging a branch that was a direct descendant of another (ie. not a fork, but this is a valid use case anyway).

    In general you stay in the 'working branch' after the merge, but you will see that the commit list for the working branch now has new entries for each of the merged revisions, and one for the merge itself.

  2. C

    @brunopostle

    Thanks for your answer, I am always pulling the latest ifcopenshell release from Githhub

    I merged my adjust-wall-width branch back with the just the out of the box merge command from git.

    However I made changes in my master branch. I added a window. It gave a merge conflict which I resolved by clicking away in VS code, then obviously my IFC was not there anymore, it wouldn't load into BlenderBIM because it was missing all kind of IFC relations.

    I am going to try a second attempt with a clean repository.

    How is ifcmerge different from the standard git merge? I was looking at the code in ifcmerge. Absolutely clueless on what's happening there exactly.

  3. C

    Feature request:

    Would it be useful to add the git log history as an IfcPropertySet to the IFC when it's being 'released'. In other words. Ready for construction.

    I found this SO post, where the command:

    git log --pretty="%C(Yellow)%h %C(reset)%ad (%C(Green)%cr%C(reset))%x09 %C(Cyan)%an: %C(reset)%s" --date=short -7

    outputs:

    
    9d94e82  2023-06-09 (23 minutes ago)     Coen Claus: Merge branch 'adjust-wall-width'
    
    5587136  2023-06-09 (31 minutes ago)     Coen Claus: edited name
    
    12af0d5  2023-06-09 (2 hours ago)        Coen Claus: added window
    
    d93bd37  2023-06-08 (23 hours ago)       Coen Claus: added pset wall properties
    
    5869603  2023-06-08 (24 hours ago)       Coen Claus: edited wall width from 100 to 200mm
    
    978bc3c  2023-06-07 (2 days ago)         Coen Claus: added two walls
    
    98df5a8  2023-06-07 (2 days ago)         Coen Claus: Added ifcgit_demo.ifc
    

    If you could assign this information as an IfcPropertySet the stakeholders involved who don't need git can also see the workflow.

  4. B

    @Coen A standard git merge always fails with forked IFC files because at the very least the FILE_NAME header line will be modified in both branches, even if nothing else has changed.

    At this point Git throws you into a conflict resolution mode, marking up the file with lines from both versions (this marked up file definitely won't load in BlenderBIM).

    You can resolve this by manually editing the file (and running git merge --continue), or you can run a mergetool that does a three-way merge. Ifcmerge is a mergetool specific to IFC files.

    BlenderBIM has logic to deal with this IFC merging thing that visual studio doesn't have. You can use visual studio to do non merge functions, tagging, branching remote operations, visualising branch trees etc..

  5. B

    @Coen yes we could add a commit log to the IFC file, but this would be another commit, so it would immediately be out-of-date.

    My plan was to make the Git tags available for insertion into drawing boxes as a revision list, this gives the author some control over what is visible to recipients.

  6. C

    @brunopostle

    Is it possible to create a git branch from the Blender UI? I thought there was a button in the standalone version, but with the integration in the BlenderBIM add-on I don't see the create branch menu anymore

  7. C

    I am absolutey clueless on how to merge two branches succesfully,

    my master branch

    my edit-wall-width branch

    I am on the lastest stable BlenderBIM release,

    my git workflow:

    I don't understand how to merge my edit-wall-width branch back into master. Don't even know where to begin.

    The merge button says 'merge the selected branch into the working branch' .

    Am I right in assuming the working branch is the branch which I have checked out?

    How can I understand what is my selected branch?

    I am getting an Ifc Merge failed notifcation with no extra info why it failed.

    Does someone have a very simple step by step merge tutorial which I could follow?

  8. B

    @Coen a branch gets created whenever you switch to an older revision, edit it, and try to commit.

    The working branch is the model that is open in blenderbim. The selected branch is the branch you are browsing in the revision list.

    This merge ought to work. I do need to do a more thorough video tutorial, but I'd like to somehow make the UI less of a boggle.

    You could also push your test model to a Github repository, and I'll see why the merge isn't working.

  9. C

    @brunopostle

    Thanks, the merge worked this time with a a third attempt. I left the master branch alone this time and didn't touch it until the merge.

  10. C

    I'm able to create and merge branches, however git fork shows me this:

    Why doesn't git fork show me all the branches I created? I can see the several branches in the termainl

  11. B

    @Coen No idea, once you have merged the branches they both have the same revision at their HEAD, maybe it is simplifying this for you.

    On the command-line you can see everything with git log --graph --branches --remotes

  12. C

    @brunopostle said:

    It will choke if you have modified the same attribute in both because it doesn't know which you prefer

    This is quite an important sentence, I managed to get the ifc merge work each time as long as I don't start working in two branches back and forth. However now I am in search of a good workflow with git branching. Modelling a building is somewhat a different process than writing software. Feature branching workflow works, but I think a different type of workflow would better fit this certain scenarios. still an extremely useful tool when collaborating with other on a remote git server I would think. And I haven't tried reverting back to old commits yet, also really useful when you have done an oopsie.

    I think @theoryshaw and @bruno_perdigao have experience with collaborating with this tool on a remote git sever, just curious to their experiences and if they have any insightful thoughts for workflows which worked for them.

  13. C

    @brunopostle

    I asked chatGPT what the Perl script exactly does in ifcmerge-2022-06-20. Just out of curiosity, why was it written in Perl?

    The code you provided appears to be a Perl script named ifcmerge. It seems to be a script for merging IFC (Industry Foundation Classes) files. Here's a breakdown of what the script does:

    1. The script starts by defining the necessary modules and packages it will use.

    2. It checks the command-line arguments to ensure that the script is executed with the correct number of arguments. It expects four arguments: base.ifc, local.ifc, remote.ifc, and merged.ifc.

    3. It initializes the necessary objects for base, local, remote, and merged IFC files using the Ifc class.

    4. The load method is used to read and load the contents of each IFC file into the corresponding object.

    5. The script compares the local and remote files against the base file to identify added, modified, and deleted entities.

    6. If both local and remote files have added entities, the script renumbers the local added entities to create space for them.

    7. The script copies added entities from both local and remote files to the merged file.

    8. Deleted entities from both local and remote files are removed from the merged file, unless they have been modified in the other file, in which case an error message is added to the @errors array.

    9. Modified entities are updated in the merged file. If an entity has been modified in both local and remote files, the script attempts to merge the attributes. If conflicts arise, an error message is added to the @errors array.

    10. If any errors occurred during the merging process, the script terminates and prints the errors.

    11. If the merging process is successful, the write method is used to write the merged content to the merged.ifc file.

    12. The script ends with a successful exit status.

    Please note that this is just an overview of the script's functionality, and further analysis may be required to fully understand its behavior and the specific requirements of the IFC files it processes.

  14. B

    @Coen reconnecting the history when merging wasn't properly working until a few days ago due to a bug in GitPython. I think @theoryshaw and @bruno_perdigao found that they needed to coordinate work to avoid having to merge.

    Merging, when it works, works very well, but there is a curious asymmetry in the process (because it is fundamentally a conflict resolution rather than a simple merge). There may have to be two merge buttons that appear to do the same thing, but which do slightly different stuff under the hood. Either that or there will need to be different behaviour if you are on a 'main' branch, or merging from a remote 'origin/main' branch vs any other branch.

  15. G

    Would it be possible to imagine similarly to how it's done in IDEs when merging two branches of a program, when appropriate, to display only the two elements that have a conflict in the 3D viewport (maybe using different colors ?), and query the user to choose which version they want to keep and which version they want to discard (or keep both). Iteratively for each conflict, until all conflicts have been resolved.

    Or more realistically a UI list of all conflicts with the name of the conflictual element and the property that is overwritten, with 3 buttons : keep incoming, discard incoming, keep both (when applicable) ?

  16. B

    @Gorgious at the moment ifcmerge reports a list of conflicts with the step ids (and the index of any conflicting attributes), this appears in a blender pop-up error message which vanishes as soon as you move the mouse.

    This could be used to highlight the conflicting elements, though if the conflict is in a non-rooted element there would be nothing to see.

    It would be easy enough to modify ifcmerge so that a conflicting attribute is always resolved in favour of one or the other version. This would result in orphaned data in the IFC, probably not a big deal as purging orphaned data seems like a core feature for BlenderBIM.

    It's actually quite difficult to generate a genuine merge conflict, you really have to try, IFC is considerably more structured than programming languages so we can merge things that wouldn't be possible with source code.

    What does generate unresolvable conflicts is that the merge resolution necessarily rewrites step IDs of conflicting entities in one or other of the two branches, so breaking the Native IFC principle that step IDs never change. This is fine if that branch is going to be discarded, but if you inadvertently carry on working on an older revision within that branch it won't be mergeable.

  17. C

    I presented ifcgit yesterday at work as part of a 'show your hobby project' to about ~40 people mainly software developers. To people who don't know what IFC is. The presentation was recorded and I showed feature branching and ifc git merging. I just looked back at the recorded presentation and I think I definitely need to work on my presentation skills ?. I forgot to mention a lot of details,talked too fast and got a lot of confused looks. The only question I got was how to 3D visualize a merge conflict. However I was quite relieved the ifc merge worked in the live demo.

  18. A

    @Coen Well done!

  19. C
  20. B

    I'll upload the screencast soon, here is the fork/branch/merge history (note four authors):

    
    *   commit dec9243d8894a8523e568fe5a2397af59969031b
    
    |\  Merge: 1404abd 2700060
    
    | | Author: Bruno Postle
    
    | | Date:   Tue Jun 27 17:05:40 2023 +0100
    
    | | 
    
    | |     Merge remote-tracking branch 'yass/master'
    
    | |     
    
    | |     # Conflicts:
    
    | |     #       model.ifc
    
    | | 
    
    | * commit 2700060d60c220a67657d85da1a8c5e91411981d
    
    | | Author: Sigma Dimensions
    
    | | Date:   Tue Jun 27 16:57:43 2023 +0100
    
    | | 
    
    | |     Unpriced Bill Of Quantities
    
    | |   
    
    * |   commit 1404abd3737bd2041bcc08a3af76bfd80280a339
    
    |\ \  Merge: f8c304e 1ffb65b
    
    | |/  Author: Bruno Postle
    
    |/|   Date:   Tue Jun 27 16:52:46 2023 +0100
    
    | |   
    
    | |       Merge branch 'branch3'
    
    | |       
    
    | |       # Conflicts:
    
    | |       #       model.ifc
    
    | | 
    
    | * commit 1ffb65b0e37606734581a7051638bffa17609f65
    
    | | Author: Bruno Postle
    
    | | Date:   Tue Jun 27 16:52:15 2023 +0100
    
    | | 
    
    | |     delete windows too
    
    | |   
    
    * |   commit f8c304e7be3cea35b9dd525afa2e695960890f91
    
    |\ \  Merge: 9862048 d27b346
    
    | | | Author: Bruno Postle
    
    | | | Date:   Tue Jun 27 16:35:24 2023 +0100
    
    | | | 
    
    | | |     Merge pull request #1 from C-Claus/master
    
    | | |     
    
    | | |     this is a change
    
    | | | 
    
    | * | commit d27b346e56bea3fe3c88469592ec7df5538242a0
    
    |/ /  Author: Coen Claus
    
    | |   Date:   Tue Jun 27 17:32:03 2023 +0200
    
    | |   
    
    | |       this is change
    
    | |   
    
    | | * commit 44740e662dc521036a8f2c7947e4112019ef4fb3
    
    | |/  Author: Bruno Postle
    
    | |   Date:   Tue Jun 27 16:54:50 2023 +0100
    
    | |   
    
    | |       adopting ryans fork
    
    | | 
    
    | * commit cd40bdef9a46fb7821292524f66d857610fd87cb
    
    |/  Author: Ryan Schultz
    
    |   Date:   Tue Jun 27 10:35:53 2023 -0500
    
    |   
    
    |       moved windows
    
    |   
    
    *   commit 98620481a6f8f479120c955e32cb2bfad2692d5e
    
    |\  Merge: f771e10 df022b7
    
    | | Author: Bruno Postle
    
    | | Date:   Tue Jun 27 16:20:11 2023 +0100
    
    | | 
    
    | |     Merge branch 'branch2'
    
    | |     
    
    | |     # Conflicts:
    
    | |     #       model.ifc
    
    | | 
    
    | * commit df022b7ae733610b3092def1998f855dd2bd6bec
    
    | | Author: Bruno Postle
    
    | | Date:   Tue Jun 27 16:19:28 2023 +0100
    
    | | 
    
    | |     thrird window added
    
    | |   
    
    * |   commit f771e101e69cf73a1fe963906e0cba5f6adefbcf
    
    |\ \  Merge: 9b7084f 4c38ccb
    
    | | | Author: Bruno Postle
    
    | | | Date:   Tue Jun 27 16:14:36 2023 +0100
    
    | | | 
    
    | | |     Merge branch 'mybranch'
    
    | | |     
    
    | | |     # Conflicts:
    
    | | |     #       model.ifc
    
    | | | 
    
    | * | commit 4c38ccb5ac2a073f4b902f8248a4606374b42f60
    
    | |/  Author: Bruno Postle
    
    | |   Date:   Tue Jun 27 16:13:27 2023 +0100
    
    | |   
    
    | |       another window added
    
    | | 
    
    * | commit 9b7084f98c049cae0aa2a1f5fc38b328ee318f7c
    
    |/  Author: Bruno Postle
    
    |   Date:   Tue Jun 27 16:12:12 2023 +0100
    
    |   
    
    |       Window added
    
    | 
    
    * commit 53774fc5e7d89b5460bcf3ea6531d45c061dae74
    
      Author: Bruno Postle
    
      Date:   Tue Jun 27 16:08:59 2023 +0100
    
          Added model.ifc
    
  21. A

    Ah damn I missed it, great job!

  22. B

    The screencast is 75 minutes long, if we had more time it could have been shorter. Thanks to everyone who joined-in, IFC Git is a collaboration tool above all:

    https://youtube.com/live/cJZhSCSSWdA

  23. A

    @brunopostle said:

    Yes, thanks to help from @bruno_perdigao add-on has been moved into BlenderBIM, so if you have the old add-on installed you should uninstall it.

    However we still have no way of shipping the git executable with BlenderBIM, so you do need to install this separately. On a Linux system you probably don't have to do anything, but on Windows you need to download git ( @Ace you don't need to do anything, you already have it). Similarly, if you want to use the experimental merge functionality, you need ifcmerge in your PATH, windows executable downloadable from here: https://github.com/brunopostle/ifcmerge/releases/tag/2022-06-20

    @brunopostle Bruno for Windows downloading Git is still a requirement right?

  24. B

    @Ace said:

    @brunopostle Bruno for Windows downloading Git is still a requirement right?

    Yes, I originally thought we might be able to do it all with the python git implementation, but we need the full git tool. I need to do some Windows instructions, including ssh keys for GitHub etc..

  25. B

    [Updated] setting up Git collaboration in BlenderBIM

    Git support is built-into BlenderBIM, but some extra tools are needed to use it.

    Install Git

    On Linux you probably already have Git installed through your package manager. On Windows, download and install from the Git website; or install it using winget, using the cmd.exe command-line (hit the Windows key and type cmd):

    winget install --id Git.Git -e --source winget

    You may have to logout and log-in again

    Install ifcmerge

    On Linux, just download the ifcmerge script, put it in your PATH, ie. in ~/.local/bin and make it executable:

    chmod +x ~/.local/bin/ifcmerge

    Windows users, download and unzip the ifcmerge.exe file, and put it somewhere in your %PATH%. A good place to put it is in the same folder as git.exe, find out where this is using this command-line:

    where git

    Github

    Git-forges can use all sorts of access methods, but Github requires you to use ssh encryption and authentication, you will need to generate an ssh-key (with no password) and upload it to your Github account, you will also need to add the Github key to your known_hosts file.

    On Windows the Git tool installed earlier has everything you need, launch the Git Gui tool, select Help > Show SSH Key, then Generate Key (if you don't already have one) and paste this text into your Github account preferences. To add Github to your known_hosts file, launch the Git Bash tool (which is a command-line like cmd.exe), and briefly connect to the Github servers:

    ssh github.com

    This will ask you if you want to add their key (fingerprint SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM) to your known_hosts, type yes and exit since you don't have permission to do anything else.

  1. Page 1
  2. 2
  3. 3
  4. 4
  5. 5

Login or Register to reply.