internal static Vector3D ReadYAxis(List <string> parameters, ref int index) { return(new Vector3D( IgesEntity.Double(parameters, ref index), IgesEntity.Double(parameters, ref index, 1.0), IgesEntity.Double(parameters, ref index))); }
public static void AssignColor(this IgesEntity entity, CadColor?color) { entity.Color = color.ToIgesColor(); if (entity.Color == IgesColorNumber.Custom) { Debug.Assert(color != null); entity.CustomColor = new IgesColorDefinition(color.GetValueOrDefault().R / 255.0, color.GetValueOrDefault().G / 255.0, color.GetValueOrDefault().B / 255.0); } }
public int GetEntityId(IgesEntity entity) { if (entity == null) { return(0); } else if (!_entityMap.ContainsKey(entity)) { throw new InvalidOperationException($"Entity not found. Did you forget to override {nameof(IgesEntity)}.{nameof(IgesEntity.GetReferencedEntities)}()?"); } return(_entityMap[entity]); }
public static CadColor?GetColor(this IgesEntity entity) { switch (entity.Color) { case IgesColorNumber.Default: return(null); case IgesColorNumber.Black: return(CadColor.Black); case IgesColorNumber.Red: return(CadColor.Red); case IgesColorNumber.Green: return(CadColor.Green); case IgesColorNumber.Blue: return(CadColor.Blue); case IgesColorNumber.Yellow: return(CadColor.Yellow); case IgesColorNumber.Magenta: return(CadColor.Magenta); case IgesColorNumber.Cyan: return(CadColor.Cyan); case IgesColorNumber.White: return(CadColor.Cyan); default: Debug.Assert(entity.CustomColor != null); var custom = entity.CustomColor; return(CadColor.FromArgb( 255, (byte)(custom.RedIntensity * 255), (byte)(custom.GreenIntensity * 255), (byte)(custom.BlueIntensity * 255))); } }
public static Entity ToEntity(this IgesEntity entity) { Entity result = null; switch (entity.EntityType) { case IgesEntityType.CircularArc: result = ToArc((IgesCircularArc)entity); break; case IgesEntityType.Line: result = ToLine((IgesLine)entity); break; case IgesEntityType.Point: result = ToLocation((IgesLocation)entity); break; } return(result); }
private static void PopulateEntities(IgesFile file, List <IgesDirectoryData> directoryEntries, Dictionary <int, Tuple <List <string>, string> > parameterMap) { var binder = new IgesReaderBinder(); for (int i = 0; i < directoryEntries.Count; i++) { var dir = directoryEntries[i]; var parameterValues = parameterMap[dir.ParameterPointer].Item1; var comment = parameterMap[dir.ParameterPointer].Item2; var entity = IgesEntity.FromData(dir, parameterValues, binder); if (entity != null) { entity.Comment = comment; var directoryIndex = (i * 2) + 1; entity.BindPointers(dir, binder); entity.OnAfterRead(dir); var postProcessed = entity.PostProcess(); binder.EntityMap[directoryIndex] = postProcessed; file.Entities.Add(postProcessed); } } binder.BindRemainingEntities(); }
public IgesBooleanTreeEntity(IgesEntity entity) { Entity = entity; }
public static Point TransformPoint(this IgesEntity entity, IgesPoint point) { var transformed = entity.TransformationMatrix.Transform(point); return(new Point(transformed.X, transformed.Y, transformed.Z)); }