diff options
author | Stephen Leger <stephen@3dservices.ch> | 2017-08-03 16:59:40 +0300 |
---|---|---|
committer | Stephen Leger <stephen@3dservices.ch> | 2017-08-14 02:16:24 +0300 |
commit | fde9aa0a3fe223e7f2eb03010faf626bac925780 (patch) | |
tree | 3cf8c0355c6892187527844d93669d0428e1f7da /archipack/archipack_slab.py | |
parent | 6e469175870222d724be17c9f14590a07e1e7e45 (diff) |
archipack: Fix issue with curved segments in walls/slab/floor
Diffstat (limited to 'archipack/archipack_slab.py')
-rw-r--r-- | archipack/archipack_slab.py | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/archipack/archipack_slab.py b/archipack/archipack_slab.py index 9f8a2947..9059f269 100644 --- a/archipack/archipack_slab.py +++ b/archipack/archipack_slab.py @@ -247,6 +247,10 @@ class SlabGenerator(CutAblePolygon, CutAbleGenerator): either external or holes cuts """ self.limits() + + self.as_lines(step_angle=0.0502) + # self.segs = [s.line for s in self.segs] + for b in o.children: d = archipack_slab_cutter.datablock(b) if d is not None: @@ -382,12 +386,21 @@ def update_type(self, context): else: w = w0.curved_slab(part.a0, part.da, part.radius) else: - g = SlabGenerator(None) - g.add_part(self) - w = g.segs[0] + if "C_" in self.type: + p = Vector((0, 0)) + v = self.length * Vector((cos(self.a0), sin(self.a0))) + w = StraightSlab(p, v) + a0 = pi / 2 + else: + c = -self.radius * Vector((cos(self.a0), sin(self.a0))) + w = CurvedSlab(c, self.radius, self.a0, pi) # w0 - w - w1 - dp = w.p1 - w.p0 + if idx + 1 == d.n_parts: + dp = - w.p0 + else: + dp = w.p1 - w.p0 + if "C_" in self.type: part.radius = 0.5 * dp.length part.da = pi @@ -494,22 +507,15 @@ class ArchipackSegment(): def draw(self, context, layout, index): box = layout.box() - row = box.row() - row.prop(self, "type", text=str(index + 1)) + box.prop(self, "type", text=str(index + 1)) self.draw_insert(context, box, index) if self.type in ['C_SEG']: - row = box.row() - row.prop(self, "radius") - row = box.row() - row.prop(self, "da") + box.prop(self, "radius") + box.prop(self, "da") else: - row = box.row() - row.prop(self, "length") - row = box.row() - row.prop(self, "a0") - row = box.row() - row.prop(self, "offset") - # row.prop(self, "linked_idx") + box.prop(self, "length") + box.prop(self, "a0") + # box.prop(self, "offset") class archipack_slab_part(ArchipackSegment, PropertyGroup): @@ -823,6 +829,7 @@ class archipack_slab(ArchipackObject, Manipulable, PropertyGroup): # start and shared: update rotation a = seg.angle - w.segs[idx].angle + if abs(a) > 0.00001: w.rotate(idx, a) @@ -831,7 +838,7 @@ class archipack_slab(ArchipackObject, Manipulable, PropertyGroup): if next_idx > -1: - if idx + 1 == next_idx: + if (idx + 1 == next_idx) or (next_idx == 0 and i + 1 == self.n_parts): # shared: should move last point # and apply to next segments # this is overriden for common segs @@ -854,11 +861,13 @@ class archipack_slab(ArchipackObject, Manipulable, PropertyGroup): last_idx = next_idx - 1 # update d from og + last_seg = None for i, seg in enumerate(w.segs): - if i > 0: - d.parts[i].a0 = seg.delta_angle(w.segs[i - 1]) - else: - d.parts[i].a0 = seg.angle + + d.parts[i].a0 = seg.delta_angle(last_seg) + + last_seg = seg + if "C_" in d.parts[i].type: d.parts[i].radius = seg.r d.parts[i].da = seg.da |