Table of Contents

Class DxfSun

Namespace
GeometryHelper.Dxf
Assembly
GeometryHelper.dll

A SUN of a DXF file, as AutoCAD's Sun: the light of the sun a viewport is lit by, owned by the viewport, which names it (group 361 of the VIEWPORT); whether it is on, its colour and intensity, the day and time it shines at and the shadows it casts, read and set as the groups of AcDbSun of the DXF reference.

public sealed class DxfSun : DxfDBObject
Inheritance
DxfSun
Inherited Members

Remarks

viewport.SetSun(new DxfSun { DateTime = new DateTime(2026, 6, 21, 15, 0, 0), Intensity = 1.5 }) lights a viewport by the sun of a summer afternoon, half as bright again as AutoCAD's: a SUN at the end of the OBJECTS section, owned by the viewport, the day written as its Julian day 2461213 (91) and the time as 54 000 seconds past midnight (92). A sun made in code is ezdxf's new sun: on, white, of intensity 1, casting shadows traced along the rays, on 21 September 2014 at noon; that AutoCAD's own new sun is the same is not confirmed.

A SUN came with R2007 (AC1021). Where the sun stands in the sky, AutoCAD's Altitude, Azimuth and SunDirection, AutoCAD works out from the drawing's geographic location and the day, and the sky (SkyParameters) is its renderer's: a SUN keeps neither, and neither is here.

Constructors

DxfSun()

Initializes a sun made in code, as AutoCAD's Sun(), with ezdxf's defaults (AutoCAD's own not confirmed): on, white, of intensity 1, casting shadows traced along the rays, on 21 September 2014 at noon; given to a viewport by SetSun(DxfSun).

Properties

DateTime

Gets or sets the day and the time of day the sun shines at (groups 91 and 92), as AutoCAD's DateTime: the Julian day and the seconds past midnight, the time at the drawing's place; 21 September 2014 at noon where the record gives neither.

Intensity

Gets or sets how bright the sun is (group 40), as AutoCAD's Intensity: 1 for AutoCAD's sun, 0 for none at all; 1 where the record gives none.

IsDaylightSavingsOn

Gets or sets whether the time is that of daylight saving (group 292), as AutoCAD's IsDaylightSavingsOn; false where the record gives none.

IsOn

Gets or sets whether the sun is on (group 290), as AutoCAD's IsOn; on where the record gives none.

ShadowMapSize

Gets or sets the size of a map of shadows (group 71), as AutoCAD's ShadowMapSize of its shadow parameters: 64 to 4 096, a power of two; 256 where the record gives none.

ShadowMapSoftness

Gets or sets how soft the edges of mapped shadows are (group 280), as AutoCAD's ShadowMapSoftness of its shadow parameters: 1 to 10; 1 where the record gives none.

ShadowType

Gets or sets how the shadows are made (group 70), as AutoCAD's ShadowType of its shadow parameters; traced along the rays where the record gives none.

ShadowsOn

Gets or sets whether the sun casts shadows (group 291), as AutoCAD's ShadowsOn of its shadow parameters; true where the record gives none.

SunColor

Gets or sets the colour of the sun's light (groups 63 and 421), as AutoCAD's SunColor: its true colour where it has one, else its colour of the index; the index 7, white, where the record gives neither.

Methods

ToString()

Gives the sun as a line for debugging: its type, its handle and whether it is on.