/// <summary> /// Lets you resize selected objects in a uniform manner, making them larger or smaller equally in all directions. You can also lock the scaling factor in any of the directions. /// </summary> /// <param name="entityToScale">The entity to scale.</param> /// <param name="scaleFactor">The scale value.</param> /// <param name="lockX">Locked in x if true.</param> /// <param name="lockY">Locked in y if true.</param> /// <param name="lockZ">Locked in z if true.</param> /// <param name="scaleOrigin">Objects are scaled relative to the scale origin.</param> /// <remarks></remarks> public static void ScaleUniform( IPSScalable entityToScale, double scaleFactor, bool lockX, bool lockY, bool lockZ, Geometry.Point scaleOrigin = null) { _powerSHAPE = ((PSEntity)entityToScale).PowerSHAPE; ((PSEntity)entityToScale).AddToSelection(true); _powerSHAPE.DoCommand("EDIT SCALE"); _powerSHAPE.DoCommand("UNIFORM"); _powerSHAPE.DoCommand("VALUE " + scaleFactor); if (lockX) { _powerSHAPE.DoCommand("LOCK X ON"); } else { _powerSHAPE.DoCommand("LOCK X OFF"); } if (lockY) { _powerSHAPE.DoCommand("LOCK Y ON"); } else { _powerSHAPE.DoCommand("LOCK Y OFF"); } if (lockZ) { _powerSHAPE.DoCommand("LOCK Z ON"); } else { _powerSHAPE.DoCommand("LOCK Z OFF"); } if (scaleOrigin != null) { _powerSHAPE.DoCommand("SCALEORIGIN"); _powerSHAPE.DoCommand(scaleOrigin.ToString()); } if (_powerSHAPE.Version.Major > 11) { _powerSHAPE.DoCommand("APPLY"); _powerSHAPE.DoCommand("DISMISS"); } else { _powerSHAPE.DoCommand("CANCEL"); } }
public override string ToString() { return("JointState: " + "\ntranslation: " + translation.ToString() + "\nangle: " + angle.ToString() + "\nupper_bound: " + upper_bound.ToString() + "\nlower_bound: " + lower_bound.ToString() + "\naxis: " + axis.ToString()); }
/// <summary> /// Resizes surfaces and solids according to their volume as projected on to the active workplane. /// </summary> /// <param name="entityToScale">The entity to scale.</param> /// <param name="newVolume">The new projected volume.</param> /// <param name="lockX">Locked in x if true.</param> /// <param name="lockY">Locked in y if true.</param> /// <param name="lockZ">Locked in z if true.</param> /// <param name="scaleOrigin">Objects are scaled relative to the scale origin.</param> /// <remarks></remarks> public static void ScaleProjectedVolume( IPSScalable entityToScale, double newVolume, bool lockX, bool lockY, bool lockZ, Geometry.Point scaleOrigin = null) { _powerSHAPE = ((PSEntity)entityToScale).PowerSHAPE; ((PSEntity)entityToScale).AddToSelection(true); _powerSHAPE.DoCommand("EDIT SCALE"); _powerSHAPE.DoCommand("UNIFORM"); _powerSHAPE.DoCommand("VALUE " + newVolume); if (lockX) { _powerSHAPE.DoCommand("LOCK X ON"); } else { _powerSHAPE.DoCommand("LOCK X OFF"); } if (lockY) { _powerSHAPE.DoCommand("LOCK Y ON"); } else { _powerSHAPE.DoCommand("LOCK Y OFF"); } if (lockZ) { _powerSHAPE.DoCommand("LOCK Z ON"); } else { _powerSHAPE.DoCommand("LOCK Z OFF"); } if (scaleOrigin != null) { _powerSHAPE.DoCommand("SCALEORIGIN"); _powerSHAPE.DoCommand(scaleOrigin.ToString()); } _powerSHAPE.DoCommand("APPLY"); _powerSHAPE.DoCommand("DISMISS"); }
public override string ToString() { return("InteractiveMarkerFeedback: " + "\nheader: " + header.ToString() + "\nclient_id: " + client_id.ToString() + "\nmarker_name: " + marker_name.ToString() + "\ncontrol_name: " + control_name.ToString() + "\nevent_type: " + event_type.ToString() + "\npose: " + pose.ToString() + "\nmenu_entry_id: " + menu_entry_id.ToString() + "\nmouse_point: " + mouse_point.ToString() + "\nmouse_point_valid: " + mouse_point_valid.ToString()); }
internal PSSurfaceSphere(PSAutomation powershape, Geometry.Point origin) : base(powershape) { // Clear CreatedItems _powerSHAPE.ActiveModel.ClearCreatedItems(); // Create a plane at the point specified _powerSHAPE.DoCommand("CREATE SURFACE SPHERE"); _powerSHAPE.DoCommand(origin.ToString()); // Get created plane id PSSurfaceSphere newSphere = (PSSurfaceSphere)_powerSHAPE.ActiveModel.CreatedItems[0]; _id = newSphere.Id; }
internal PSSolidTorus(PSAutomation powershape, Geometry.Point origin) : base(powershape) { // Clear CreatedItems _powerSHAPE.ActiveModel.ClearCreatedItems(); // Create a plane at the point specified _powerSHAPE.DoCommand("CREATE SOLID TORUS"); _powerSHAPE.DoCommand(origin.ToString()); // Get created plane id PSSolidTorus newTorus = (PSSolidTorus)_powerSHAPE.ActiveModel.CreatedItems[0]; _id = newTorus.Id; }
public override string ToString() { return("ImageMarker: " + "\nheader: " + header.ToString() + "\nns: " + ns.ToString() + "\nid: " + id.ToString() + "\ntype: " + type.ToString() + "\naction: " + action.ToString() + "\nposition: " + position.ToString() + "\nscale: " + scale.ToString() + "\noutline_color: " + outline_color.ToString() + "\nfilled: " + filled.ToString() + "\nfill_color: " + fill_color.ToString() + "\nlifetime: " + lifetime.ToString() + "\npoints: " + System.String.Join(", ", points.ToList()) + "\noutline_colors: " + System.String.Join(", ", outline_colors.ToList())); }
/// <summary> /// Creates a workplane aligned to the current view at the specified origin /// </summary> internal PSWorkplane(PSAutomation powerSHAPE, Geometry.Point origin) : base(powerSHAPE) { // Create the workplane _powerSHAPE.DoCommand("CREATE WORKPLANE VIEWSINGLE"); _powerSHAPE.DoCommand(origin.ToString()); // Try to get workplane details try { PSWorkplane newWorkplane = (PSWorkplane)_powerSHAPE.ActiveModel.CreatedItems[0]; _name = newWorkplane.Name; _id = newWorkplane.Id; } catch { throw new ApplicationException("Failed to create Workplane"); } }
/// <summary> /// Cuts a single entity at a defined point. /// </summary> /// <param name="entityToCut">The entity to cut.</param> /// <param name="pointAtWhichToCut">The point at which to cut the entity, which must lie on the entity.</param> /// <returns>A piece of the original entity.</returns> public static PSEntity CutEntity(PSEntity entityToCut, Geometry.Point pointAtWhichToCut) { // Get PowerSHAPE instance _powerSHAPE = entityToCut.PowerSHAPE; // Cut entity entityToCut.AddToSelection(true); _powerSHAPE.DoCommand("EDIT LIMIT CUTS"); _powerSHAPE.DoCommand(pointAtWhichToCut.ToString()); _powerSHAPE.DoCommand("EDIT LIMIT CUTS OFF"); // Check that operation worked if (_powerSHAPE.ActiveModel.CreatedItems.Count == 0) { throw new ApplicationException("Cut operation did not function correctly"); } // Get created entity PSEntity newEntity = _powerSHAPE.ActiveModel.CreatedItems[0]; newEntity.Id = _powerSHAPE.ReadIntValue(newEntity.Identifier + "['" + newEntity.Name + "'].ID"); _powerSHAPE.ActiveModel.Add(newEntity); return(newEntity); }
public override string ToString() { return("BoundingBoxQueryRequest: " + "\nmin: " + min.ToString() + "\nmax: " + max.ToString()); }