Skip to content

Commit

Permalink
Implement Rule Suggest
Browse files Browse the repository at this point in the history
+ fix Connector planes
+ fix input pin descriptions
  • Loading branch information
janper committed Mar 6, 2021
1 parent d239d9f commit 13a09e9
Show file tree
Hide file tree
Showing 26 changed files with 288 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Components/Materialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ComponentMaterializeSlots( ) : base("Materialize Slots",
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) {
pManager.AddParameter(new ModuleParameter(),
"Module",
"Modules",
"M",
"All Monoceros Modules",
GH_ParamAccess.list);
Expand Down
6 changes: 3 additions & 3 deletions Components/ModuleConstruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ protected override void RegisterInputParams(GH_Component.GH_InputParamManager pM
"Points inside the Module Parts. Module parts will be fit" +
" into the Slots of the Envelope.",
GH_ParamAccess.list);
pManager.AddGeometryParameter("Production Geometry",
pManager.AddGeometryParameter("Geometry",
"G",
"Geometry used to materialize the result of the " +
"Monoceros Solver. Production geometry does not have to fit " +
"into the generated module cage and can be larger, " +
"Monoceros Solver. The Module geometry does not have to fit " +
"into the generated Module cage and can be larger, " +
"smaller, different or none.",
GH_ParamAccess.list);
pManager[2].Optional = true;
Expand Down
4 changes: 2 additions & 2 deletions Components/ModuleDeconstruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager
pManager.AddVectorParameter("Connector Directions",
"CD",
"Directions of connectors as unit vectors aligned to the " +
"base plane - a list parallel to C.",
"base plane - a list parallel to CP.",
GH_ParamAccess.list);
pManager.AddBooleanParameter("Connector Use Pattern",
"UP",
"Connector use pattern - a list parallel to C. " +
"Connector use pattern - a list parallel to CP. " +
"(only if R are provided)",
GH_ParamAccess.list);
pManager.AddBooleanParameter("Is Compact",
Expand Down
2 changes: 1 addition & 1 deletion Components/PopulateGeometryWithSlotCenters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected override void RegisterInputParams(GH_Component.GH_InputParamManager pM
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) {
pManager.AddPointParameter("Slot Centers",
"Pt",
"Points ready to be used as Monoceros Slot centers",
"Points ready to be used as Monoceros Slot centers or Module Part centers",
GH_ParamAccess.list);
}

Expand Down
5 changes: 1 addition & 4 deletions Components/RuleAssemble.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public ComponentAssembleRule( ) : base("Assemble Rule",
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) {
pManager.AddParameter(new ModuleParameter(),
"Module",
"Modules",
"M",
"All Monoceros Modules",
GH_ParamAccess.list);
Expand Down Expand Up @@ -145,8 +145,6 @@ protected override void SolveInstance(IGH_DataAccess DA) {
return;
}

//_sourceModuleGeometry = sourceModule.Geometry;
//_sourceModuleGuids = sourceModule.ReferencedGeometryGuids;
var sourceModuleTransform = Transform.PlaneToPlane(sourceModule.Pivot, basePlane);
var sourceModuleGeometry = sourceModule.Geometry.Select(geo => {
var placedGeometry = geo.Duplicate();
Expand All @@ -164,7 +162,6 @@ protected override void SolveInstance(IGH_DataAccess DA) {

var transformedSourceConnectorPlane = sourceConnector.AnchorPlane.Clone();
transformedSourceConnectorPlane.Transform(sourceModuleTransform);
transformedSourceConnectorPlane.Rotate(Math.PI, transformedSourceConnectorPlane.YAxis);
var targetModuleTransform = Transform.PlaneToPlane(targetConnector.AnchorPlane,
transformedSourceConnectorPlane);
var targetModuleGeometry = targetModule.Geometry.Select(geo => {
Expand Down
4 changes: 2 additions & 2 deletions Components/RuleExplicitFromCurve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ protected override void SolveInstance(IGH_DataAccess DA) {
}
for (var startConnectorIndex = 0; startConnectorIndex < startModule.Connectors.Count; startConnectorIndex++) {
var startConnector = startModule.Connectors[startConnectorIndex];
if (startConnector.ContaininsPoint(curve.PointAtStart)) {
if (startConnector.ContainsPoint(curve.PointAtStart)) {
foreach (var endModule in modules) {
if (endModule == null || !endModule.IsValid) {
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The module is null or invalid.");
continue;
}
for (var endConnectorIndex = 0; endConnectorIndex < endModule.Connectors.Count; endConnectorIndex++) {
var endConnector = endModule.Connectors[endConnectorIndex];
if (endConnector.ContaininsPoint(curve.PointAtEnd)
if (endConnector.ContainsPoint(curve.PointAtEnd)
&& startConnector.Direction.IsOpposite(endConnector.Direction)) {
rules.Add(new Rule(startModule.Name,
(uint)startConnectorIndex,
Expand Down
2 changes: 1 addition & 1 deletion Components/RuleIndifferentConstruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected override void RegisterInputParams(GH_InputParamManager pManager) {
/// </summary>
protected override void RegisterOutputParams(GH_OutputParamManager pManager) {
pManager.AddParameter(new RuleParameter(),
"Rule",
"Rule Indifferent",
"R",
"Monoceros Rule",
GH_ParamAccess.item);
Expand Down
4 changes: 2 additions & 2 deletions Components/RuleIndifferentFromPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override void RegisterInputParams(GH_Component.GH_InputParamManager pM
/// </summary>
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) {
pManager.AddParameter(new RuleParameter(),
"Rules",
"Rules Indifferent",
"R",
"Monoceros Rules",
GH_ParamAccess.list);
Expand Down Expand Up @@ -68,7 +68,7 @@ protected override void SolveInstance(IGH_DataAccess DA) {
}
for (var connectorIndex = 0; connectorIndex < module.Connectors.Count; connectorIndex++) {
var connector = module.Connectors[connectorIndex];
if (connector.ContaininsPoint(point)) {
if (connector.ContainsPoint(point)) {
rules.Add(new Rule(module.Name, (uint)connectorIndex, type));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Components/RuleIndifferentUnused.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected override void RegisterInputParams(GH_Component.GH_InputParamManager pM
/// </summary>
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager) {
pManager.AddParameter(new RuleParameter(),
"Rules",
"Rules Indifferent",
"R",
"Monoceros Rules",
GH_ParamAccess.list);
Expand Down
6 changes: 5 additions & 1 deletion Components/RuleIsTyped.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ public ComponentIsRuleTyped( ) : base("Is Rule Typed", "IsRuleTyp",
/// Registers all the input parameters for this component.
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) {
pManager.AddParameter(new RuleParameter(), "Rule", "R", "Monoceros Rule", GH_ParamAccess.item);
pManager.AddParameter(new RuleParameter(),
"Rule",
"R",
"Monoceros Rule",
GH_ParamAccess.item);
}

/// <summary>
Expand Down
10 changes: 5 additions & 5 deletions Components/RuleOuterContruct.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ public ComponentRuleOuterConstruct( )
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) {
pManager.AddParameter(new ModuleParameter(),
"Modules",
"Module",
"M",
"All available Monoceros modules",
"Monoceros Module to be placed at the envelope boundary",
GH_ParamAccess.item);
pManager.AddParameter(new ConnectorIndexParameter(),
"Source Connector Index",
"SC",
"Source connector number",
"Connector Index",
"C",
"Connector number to be adjacent to the envelope boundary",
GH_ParamAccess.item);
}

Expand Down
4 changes: 2 additions & 2 deletions Components/RuleOuterFromPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected override void RegisterInputParams(GH_Component.GH_InputParamManager pM
GH_ParamAccess.list);
pManager.AddPointParameter("Point Tag",
"Pt",
"Point marking a connector",
"Point marking a connector to be adjacent to the envelope boundary",
GH_ParamAccess.item);
}

Expand Down Expand Up @@ -70,7 +70,7 @@ protected override void SolveInstance(IGH_DataAccess DA) {
for (var connectorIndex = 0; connectorIndex < module.Connectors.Count; connectorIndex++) {
var connector = module.Connectors[connectorIndex];
var oppositeDirection = connector.Direction.ToFlipped();
if (connector.ContaininsPoint(point)) {
if (connector.ContainsPoint(point)) {
rules.Add(
new Rule(module.Name,
(uint)connectorIndex,
Expand Down
6 changes: 3 additions & 3 deletions Components/RulePreview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ public ComponentPreviewRules( )
/// </summary>
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager) {
pManager.AddParameter(new ModuleParameter(),
"Module",
"Modules",
"M",
"Monoceros module for indifferent rule generation",
"Monoceros Modules",
GH_ParamAccess.list);
pManager.AddParameter(new RuleParameter(),
"Rules",
"R",
"All existing Monoceros rules",
"All existing Monoceros Rules",
GH_ParamAccess.list);
pManager[0].Optional = true;
pManager[1].Optional = true;
Expand Down
Loading

0 comments on commit 13a09e9

Please sign in to comment.