Hi all,
For some reason, I cannot create a roof using the Script.AddRoofFromCurve() method. Yet I can select the created curve inside of Rhino and do vaRoof from curves and it will work just fine?
The AddRoofFromCurve always returns an empty Guid.
using Masonry3D.Core.HelpersIn3D;
using Rhino;
using Rhino.Commands;
using Rhino.DocObjects;
using Rhino.Geometry;
using System;
using System.Drawing;
using Varq = VisualARQ.Script;
namespace Masonry3D.RC.Commands.RhinoCommands;
public class TestAnythingCommand : Command
{
#region Rhino Command Boilerplate
public TestAnythingCommand()
{
// Rhino only creates one instance of each command class defined in a
// plug-in, so it is safe to store a refence in a static property.
Instance = this;
}
///<summary>The only instance of this command.</summary>
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
// This is default RhinoCommon code - it knowns what it is doing
public static TestAnythingCommand Instance { get; private set; }
#pragma warning restore CS8618
#endregion
///<returns>The command name as it appears on the Rhino command line.</returns>
public override string EnglishName => "t3TestAnything";
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
Polyline pl = TraceHelper.PolylineTrace(doc); // Spits out a standard, closed polyline
Curve cv = pl.ToNurbsCurve(); // I can make a VA roof from this curve actually inside of Rhino
ObjectAttributes attributes = new() { ColorSource = ObjectColorSource.ColorFromObject, ObjectColor = Color.Purple };
doc.Objects.Add(cv, attributes);
doc.Views.Redraw();
Guid[] result = Varq.GetAllRoofStyleIds(); // Doesn't matter if I use my own style
Guid id = Varq.AddRoofFromCurve(result[0], cv); // gives me Guid.Empty
doc.Views.Redraw();
return Result.Success;
}
}
Thank you for your help!