diff --git a/src/DatabaseServices/Entity/CompositeEntity.ts b/src/DatabaseServices/Entity/CompositeEntity.ts index 773b0620b..def9b4c31 100644 --- a/src/DatabaseServices/Entity/CompositeEntity.ts +++ b/src/DatabaseServices/Entity/CompositeEntity.ts @@ -69,8 +69,11 @@ export abstract class CompositeEntity extends Entity { return this.Entitys.map(e => { - let cloneE = e.Clone(); - cloneE.Material = e.Material; + if (!e.Db && this._db) + e.SetDatabase(this._db); + let cloneE = e.Clone(false); + if (!(cloneE instanceof CompositeEntity)) + cloneE.Material = e.Material; return cloneE.ApplyMatrix(this.OCSNoClone); }); } diff --git a/src/DatabaseServices/Entity/Extrude.ts b/src/DatabaseServices/Entity/Extrude.ts index 8da8f667d..f746a5cfb 100644 --- a/src/DatabaseServices/Entity/Extrude.ts +++ b/src/DatabaseServices/Entity/Extrude.ts @@ -126,7 +126,7 @@ export class ExtrudeSolid extends Entity set Material(materialId: ObjectId) { - let oldMaterial = this.Material ?? this._db?.DefaultMaterial.objectId; + let oldMaterial = this.Material ?? this._db?.DefaultMaterial?.objectId; super.Material = materialId; let isf_old = Boolean(oldMaterial?.Object?.IsFull); diff --git a/src/UI/Components/RightPanel/CompositeMetalsPanel.tsx b/src/UI/Components/RightPanel/CompositeMetalsPanel.tsx index 9e95a199b..763e66954 100644 --- a/src/UI/Components/RightPanel/CompositeMetalsPanel.tsx +++ b/src/UI/Components/RightPanel/CompositeMetalsPanel.tsx @@ -177,7 +177,8 @@ export class CompositeMatalPanel extends React.Component