Skip to content

Commit

Permalink
Merge pull request #1040 from mcneel/1.17
Browse files Browse the repository at this point in the history
1.17
  • Loading branch information
kike-garbo authored Nov 21, 2023
2 parents c8719ce + 23b29f4 commit c439f5d
Show file tree
Hide file tree
Showing 28 changed files with 988 additions and 265 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 6 additions & 0 deletions docs/pages/_en/1.0/reference/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ group: Deployment & Configs
### WIP

- Added support for Rhino 8.0
- Implemented conversion from 'Element' to 'Model Content' on some types.
- Fix on 'Annotation Leaders' component when used on an `ARDB.TextNote`.
- Fix on 'Material' conversion on Rhino 8.
- Fix on 'Query Sheets' when wildcard is used as input.
- Fixed a bug that makes Grasshopper previews visible on Revit type preview dialog.
- Fix on `PersistentParam` context menu when it contains deleted elements.

### RC

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ namespace RhinoInside.Revit.GH.Components.DirectShapes
using Kernel.Attributes;
using External.DB.Extensions;

public class DirectShapeByBrep : ReconstructElementComponent
public class AddDirectShapeBrep : ReconstructElementComponent
{
public override Guid ComponentGuid => new Guid("5ADE9AE3-588C-4285-ABC5-09DEB92C6660");
public override GH_Exposure Exposure => GH_Exposure.primary;

public DirectShapeByBrep() : base
public AddDirectShapeBrep() : base
(
name: "Add Brep DirectShape",
name: "Add DirectShape (Brep)",
nickname: "B-Shape",
description: "Given a Brep, it adds a Brep shape to the active Revit document",
category: "Revit",
subCategory: "DirectShape"
)
{ }

void ReconstructDirectShapeByBrep
void ReconstructAddDirectShapeBrep
(
[Optional, NickName("DOC")]
ARDB.Document document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ namespace RhinoInside.Revit.GH.Components.DirectShapes
using Kernel.Attributes;
using External.DB.Extensions;

public class DirectShapeByCurve : ReconstructElementComponent
public class AddDirectShapeCurve : ReconstructElementComponent
{
public override Guid ComponentGuid => new Guid("77F4FBDD-8A05-44A3-AC54-E52A79CF3E5A");
public override GH_Exposure Exposure => GH_Exposure.primary;

public DirectShapeByCurve() : base
public AddDirectShapeCurve() : base
(
name: "Add Curve DirectShape",
name: "Add DirectShape (Curve)",
nickname: "C-Shape",
description: "Given a Curve, it adds a Curve shape to the active Revit document",
category: "Revit",
subCategory: "DirectShape"
)
{ }

void ReconstructDirectShapeByCurve
void ReconstructAddDirectShapeCurve
(
[Optional, NickName("DOC")]
ARDB.Document document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ namespace RhinoInside.Revit.GH.Components.DirectShapes
using Kernel.Attributes;
using External.DB.Extensions;

public class DirectShapeByMesh : ReconstructElementComponent
public class AddDirectShapeMesh : ReconstructElementComponent
{
public override Guid ComponentGuid => new Guid("5542506A-A09E-4EC9-92B4-F2B52417511C");
public override GH_Exposure Exposure => GH_Exposure.primary;

public DirectShapeByMesh() : base
public AddDirectShapeMesh() : base
(
name: "Add Mesh DirectShape",
name: "Add DirectShape (Mesh)",
nickname: "M-Shape",
description: "Given a Mesh, it adds a Mesh shape to the active Revit document",
category: "Revit",
subCategory: "DirectShape"
)
{ }

void ReconstructDirectShapeByMesh
void ReconstructAddDirectShapeMesh
(
[Optional, NickName("DOC")]
ARDB.Document document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ namespace RhinoInside.Revit.GH.Components.DirectShapes
using Kernel.Attributes;
using External.DB.Extensions;

public class DirectShapeByPoint : ReconstructElementComponent
public class AddDirectShapePoint : ReconstructElementComponent
{
public override Guid ComponentGuid => new Guid("7A889B89-C423-4ED8-91D9-5CECE1EE803D");
public override GH_Exposure Exposure => GH_Exposure.primary;

public DirectShapeByPoint() : base
public AddDirectShapePoint() : base
(
name: "Add Point DirectShape",
name: "Add DirectShape (Point)",
nickname: "P-Shape",
description: "Given a Point, it adds a Point shape to the active Revit document",
category: "Revit",
subCategory: "DirectShape"
)
{ }

void ReconstructDirectShapeByPoint
void ReconstructAddDirectShapePoint
(
[Optional, NickName("DOC")]
ARDB.Document document,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
using Grasshopper.Kernel;
using Grasshopper.Kernel.Types;
using ARDB = Autodesk.Revit.DB;
#if RHINO_8
using Grasshopper.Rhinoceros.Model;
#endif

namespace RhinoInside.Revit.GH.Components.DirectShapes
{
Expand All @@ -20,12 +23,37 @@ protected ReconstructDirectShapeComponent(string name, string nickname, string d

protected static GeometryBase AsGeometryBase(IGH_GeometricGoo obj)
{
#if RHINO_8
if (obj is GH_InstanceReference iref)
{
if (iref.InstanceDefinition is ModelInstanceDefinition idef && GeometryEncoder.Context.Peek.Document is ARDB.Document document)
{
var definitionId = Guid.NewGuid();
var library = ARDB.DirectShapeLibrary.GetDirectShapeLibrary(document);
if (!library.Contains(definitionId.ToString()))
{
var shape = idef.Objects.SelectMany(x =>
{
if (x.CastTo(out IGH_GeometricGoo geo))
return AsGeometryBase(geo).ToShape();

return null;
}).OfType<ARDB.GeometryObject>();

library.AddDefinition(definitionId.ToString(), shape.ToList());
}
return new InstanceReferenceGeometry(definitionId, iref.Value.Xform);
}
else return null;
}
#endif

var scriptVariable = obj.ScriptVariable();
switch (scriptVariable)
{
case Point3d point: return new Point(point);
case Line line: return new LineCurve(line);
case Rectangle3d rect: return rect.ToNurbsCurve();
case Rectangle3d rect: return new PolylineCurve(rect.ToPolyline());
case Arc arc: return new ArcCurve(arc);
case Circle circle: return new ArcCurve(circle);
case Ellipse ellipse: return ellipse.ToNurbsCurve();
Expand Down Expand Up @@ -139,22 +167,22 @@ public static bool IsValidCategoryId(ARDB.ElementId categoryId, ARDB.Document do
}
}

public class DirectShapeByGeometry : ReconstructDirectShapeComponent
public class AddDirectShapeGeometry : ReconstructDirectShapeComponent
{
public override Guid ComponentGuid => new Guid("0BFBDA45-49CC-4AC6-8D6D-ECD2CFED062A");
public override GH_Exposure Exposure => GH_Exposure.secondary;

public DirectShapeByGeometry() : base
public AddDirectShapeGeometry() : base
(
name: "Add Geometry DirectShape",
name: "Add DirectShape (Geometry)",
nickname: "G-Shape",
description: "Given its Geometry, it adds a DirectShape element to the active Revit document",
category: "Revit",
subCategory: "DirectShape"
)
{ }

void ReconstructDirectShapeByGeometry
void ReconstructAddDirectShapeGeometry
(
[Optional, NickName("DOC")]
ARDB.Document document,
Expand Down Expand Up @@ -201,12 +229,12 @@ [Optional] IList<ARDB.Material> material
}
}

public class DirectShapeTypeByGeometry : ReconstructDirectShapeComponent
public class AddDirectShapeType : ReconstructDirectShapeComponent
{
public override Guid ComponentGuid => new Guid("25DCFE8E-5BE9-460C-80E8-51B7041D8FED");
public override GH_Exposure Exposure => GH_Exposure.secondary;

public DirectShapeTypeByGeometry() : base
public AddDirectShapeType() : base
(
name: "Add DirectShape Type",
nickname: "D-ShapeType",
Expand All @@ -216,7 +244,7 @@ public DirectShapeTypeByGeometry() : base
)
{ }

void ReconstructDirectShapeTypeByGeometry
void ReconstructAddDirectShapeType
(
[Optional, NickName("DOC")]
ARDB.Document document,
Expand Down Expand Up @@ -260,22 +288,22 @@ [Optional] IList<ARDB.Material> material
}
}

public class DirectShapeByLocation : ReconstructElementComponent
public class AddDirectShapeInstance : ReconstructElementComponent
{
public override Guid ComponentGuid => new Guid("A811EFA4-8DE2-46F3-9F88-3D4F13FE40BE");
public override GH_Exposure Exposure => GH_Exposure.secondary;

public DirectShapeByLocation() : base
public AddDirectShapeInstance() : base
(
name: "Add DirectShape",
name: "Add DirectShape Instance",
nickname: "D-Shape",
description: "Given its location, it reconstructs a DirectShape into the active Revit document",
category: "Revit",
subCategory: "DirectShape"
)
{ }

void ReconstructDirectShapeByLocation
void ReconstructAddDirectShapeInstance
(
[Optional, NickName("DOC")]
ARDB.Document document,
Expand Down
Loading

0 comments on commit c439f5d

Please sign in to comment.