Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v0.6.0' into v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ahladik committed Mar 9, 2021
2 parents 530f36e + f7175a6 commit f4564ec
Show file tree
Hide file tree
Showing 10 changed files with 142 additions and 32 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ci-blenderbim-matrix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Publish-blenderbim-multiplatform

on:
push:
paths:
- 'src/ifcblenderexport/*'
- '.github/workflows/ci-blenderbim-matrix.yml'

env:
major: 0
minor: 0
name: blenderbim

jobs:
activate:
runs-on: ubuntu-latest
if: |
github.repository == 'IfcOpenShell/IfcOpenShell' &&
contains(github.event.head_commit.message, '[Release]')
steps:
- name: Set env
run: echo ok go

build:
name: ${{ matrix.config.name }}-${{ matrix.pyver }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pyver: [py37, py39]
config:
- {
name: "Windows Build",
short_name: win,
}
- {
name: "Linux Build",
short_name: linux
}
- {
name: "MacOS Build",
short_name: macos
}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2 # https://github.com/actions/setup-python
with:
python-version: '3.7.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: echo ${{ env.DATE }}
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%y%m%d')"
- name: Compile
run: |
cp -r src/ifcblenderexport src/ifcblenderexport_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
cd src/ifcblenderexport_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }}
- name: Upload Zip file to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: src/ifcblenderexport_${{ matrix.config.short_name }}_${{ matrix.pyver }}/dist/blender28-bim-${{steps.date.outputs.date}}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip
asset_name: blender28-bim-${{steps.date.outputs.date}}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip
tag: "blenderbim-${{steps.date.outputs.date}}"
overwrite: true
body: "Package release blenderbim-${{steps.date.outputs.date}}"
9 changes: 7 additions & 2 deletions src/ifcblenderexport/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,20 @@ endif
rm -rf dist/working

# Required by IFCClash
mkdir dist/working
ifeq ($(PLATFORM), linux)
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/0c/fa/00d85f893b02289e2942849d97f8818dde8e2111182e825fb3a735677791/python_fcl-0.0.12-cp37-cp37m-manylinux1_x86_64.whl
cd dist/working && unzip python_fcl*
cp -r dist/working/fcl dist/blenderbim/libs/site/packages/
rm -rf dist/working
endif
ifeq ($(PLATFORM), win)
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/19/e6/6e9f33fb59e8f27c0e1592bd26e644bc92b85c942b072b2d3854105d5887/python_fcl_win32-0.0.12.post3-py3-none-win_amd64.whl
endif
cd dist/working && unzip python_fcl*
cp -r dist/working/fcl dist/blenderbim/libs/site/packages/
rm -rf dist/working
endif

# Required by BIMTester
mkdir dist/working
Expand Down
2 changes: 2 additions & 0 deletions src/ifcblenderexport/blenderbim/bim/module/root/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ def execute(self, context):
for obj in objects:
if obj.BIMObjectProperties.ifc_definition_id:
obj.BIMObjectProperties.ifc_definition_id = 0
if "Ifc" in obj.name and "/" in obj.name:
obj.name = "/".join(obj.name.split("/")[1:])
return {"FINISHED"}


Expand Down
9 changes: 7 additions & 2 deletions src/ifcblenderexport/blenderbim/bim/module/root/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ def draw(self, context):
props = context.active_object.BIMObjectProperties
if props.ifc_definition_id:
if props.ifc_definition_id not in Data.products:
Data.load(props.ifc_definition_id)
try:
Data.load(props.ifc_definition_id)
except:
row = self.layout.row(align=True)
row.label(text="IFC Element Not Found")
row.operator("bim.unlink_object", icon="UNLINKED", text="")
if props.is_reassigning_class:
row = self.layout.row(align=True)
row.operator("bim.reassign_class", icon="CHECKMARK")
Expand All @@ -35,7 +40,7 @@ def draw(self, context):
row = self.layout.row(align=True)
row.label(text=name)
row.operator("bim.copy_class", icon="DUPLICATE", text="").obj = context.active_object.name
row.operator("bim.unlink_object", icon="UNLINKED", text="").obj = context.active_object.name
row.operator("bim.unlink_object", icon="UNLINKED", text="")
row.operator("bim.enable_reassign_class", icon="GREASEPENCIL", text="")
row.operator("bim.unassign_class", icon="X", text="").obj = context.active_object.name
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
classes = (
operator.AddStyle,
operator.EditStyle,
operator.UnlinkStyle,
ui.BIM_PT_style,
)

Expand Down
16 changes: 14 additions & 2 deletions src/ifcblenderexport/blenderbim/bim/module/style/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import blenderbim.bim.module.style.edit_style as edit_style
from blenderbim.bim.ifc import IfcStore

# from blenderbim.bim.module.spatial.data import Data


def get_colour_settings(material):
transparency = material.diffuse_color[3]
Expand Down Expand Up @@ -48,3 +46,17 @@ def execute(self, context):
style = add_style.Usecase(self.file, settings).execute()
material.BIMMaterialProperties.ifc_style_id = int(style.id())
return {"FINISHED"}


class UnlinkStyle(bpy.types.Operator):
bl_idname = "bim.unlink_style"
bl_label = "Unlink Style"
material: bpy.props.StringProperty()

def execute(self, context):
self.file = IfcStore.get_file()
material = bpy.data.materials.get(self.material)
material.BIMMaterialProperties.ifc_style_id = 0
if "Ifc" in material.name and "/" in material.name:
material.name = "/".join(material.name.split("/")[1:])
return {"FINISHED"}
4 changes: 3 additions & 1 deletion src/ifcblenderexport/blenderbim/bim/module/style/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ def poll(cls, context):

def draw(self, context):
props = context.active_object.active_material.BIMMaterialProperties
row = self.layout.row()
row = self.layout.row(align=True)
if props.ifc_style_id:
row.operator("bim.edit_style", icon="GREASEPENCIL")
op = row.operator("bim.unlink_style", icon="UNLINKED", text="")
op.material = context.active_object.active_material.name
else:
row.operator("bim.add_style", icon="ADD")
52 changes: 28 additions & 24 deletions src/ifcblenderexport/blenderbim/bim/module/type/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ class AssignType(bpy.types.Operator):

def execute(self, context):
self.file = IfcStore.get_file()
related_object = bpy.data.objects.get(self.related_object) if self.related_object else bpy.context.active_object
oprops = related_object.BIMObjectProperties
props = related_object.BIMTypeProperties
relating_type = self.relating_type or int(props.relating_type)
assign_type.Usecase(
self.file,
{
"related_object": self.file.by_id(oprops.ifc_definition_id),
"relating_type": self.file.by_id(relating_type),
},
).execute()
Data.load(oprops.ifc_definition_id)

if self.file.by_id(relating_type).RepresentationMaps:
bpy.ops.bim.map_representations(product_id=oprops.ifc_definition_id, type_product_id=relating_type)
relating_type = self.relating_type or int(context.active_object.BIMTypeProperties.relating_type)
related_objects = (
[bpy.data.objects.get(self.related_object)] if self.related_object else bpy.context.selected_objects
)
for related_object in related_objects:
oprops = related_object.BIMObjectProperties
assign_type.Usecase(
self.file,
{
"related_object": self.file.by_id(oprops.ifc_definition_id),
"relating_type": self.file.by_id(relating_type),
},
).execute()
Data.load(oprops.ifc_definition_id)
if self.file.by_id(relating_type).RepresentationMaps:
bpy.ops.bim.map_representations(product_id=oprops.ifc_definition_id, type_product_id=relating_type)

bpy.ops.bim.disable_editing_type(obj=related_object.name)
return {"FINISHED"}
Expand All @@ -45,15 +46,18 @@ class UnassignType(bpy.types.Operator):

def execute(self, context):
self.file = IfcStore.get_file()
related_object = bpy.data.objects.get(self.related_object) if self.related_object else bpy.context.active_object
oprops = related_object.BIMObjectProperties
unassign_type.Usecase(
self.file,
{
"related_object": self.file.by_id(oprops.ifc_definition_id),
},
).execute()
Data.load(oprops.ifc_definition_id)
related_objects = (
[bpy.data.objects.get(self.related_object)] if self.related_object else bpy.context.selected_objects
)
for related_object in related_objects:
oprops = related_object.BIMObjectProperties
unassign_type.Usecase(
self.file,
{
"related_object": self.file.by_id(oprops.ifc_definition_id),
},
).execute()
Data.load(oprops.ifc_definition_id)
return {"FINISHED"}


Expand Down
2 changes: 1 addition & 1 deletion src/ifcblenderexport/generate_util_type_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
entity = line[len("ENTITY ") : -1]
elif "END_ENTITY" in line:
is_in_where_rule = False
elif entity and "CorrectTypeAssigned" in line:
elif entity and ("CorrectTypeAssigned" in line or "CorrectStyleAssigned" in line):
is_in_where_rule = True
elif entity and is_in_where_rule and "IN TYPEOF" in line and "RelatingType" in line:
type_class = line.split("'")[1].split(".")[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@
"IfcDistributionChamberElement": [
"IFCDISTRIBUTIONCHAMBERELEMENTTYPE"
],
"IfcDoor": [
"IFCDOORTYPE"
],
"IfcDuctFitting": [
"IFCDUCTFITTINGTYPE"
],
Expand Down Expand Up @@ -302,12 +305,18 @@
"IfcWasteTerminal": [
"IFCWASTETERMINALTYPE"
],
"IfcWindow": [
"IFCWINDOWTYPE"
],
"IfcBeamStandardCase": [
"IFCBEAMTYPE"
],
"IfcColumnStandardCase": [
"IFCCOLUMNTYPE"
],
"IfcDoorStandardCase": [
"IFCDOORTYPE"
],
"IfcMemberStandardCase": [
"IFCMEMBERTYPE"
],
Expand All @@ -325,5 +334,8 @@
],
"IfcWallStandardCase": [
"IFCWALLTYPE"
],
"IfcWindowStandardCase": [
"IFCWINDOWTYPE"
]
}

0 comments on commit f4564ec

Please sign in to comment.