Jump to content

Editing sunproperties in scriptfile


fransblok

Recommended Posts

Is there a way to edit the date and time on the command prompt, rather than in the sunproperties dialog?

 

I'd like write a scriptfile that automatically sets date and time to a number of relevant values and then renders those lighting conditions.

 

Regards,

 

Frans

Link to comment
Share on other sites

I don't think so,i know about sun(on/off).You can see my tips...http://www.cadtutor.net/forum/showthread.php?t=24772

Link to comment
Share on other sites

I believe the laterest versions of AutoCAD are using a different rendering engine but I know for a fact that my r14 can do it by using (c:light) with the appropriate modes and options assigned. Look in your help system to see if you have something called "Accessing Externally Defined Commands" Although perhaps they are now native commands. Here are just two entries from my help file:

 

Here's what r14 says under "Light:

 

(c:light mode [options])

 

Mode

 

A

 

Sets or retrieves the ambient light intensity.

(c:light "A" [intensity )

The intensity argument is a real number from 0.0 to 1.0; if intensity is omitted, it defaults to 1.0. The color argument is a list that specifies any RGB triplet; if omitted, it defaults to (1.0 1.0 1.0).

For example, to set ambient light intensity to 0.6,

(c:light "A" 0.6)

To retrieve the current ambient light intensity, do not pass the intensity argument.

(c:light "A") returns (0.3 (1.0 1.0 1.0)), which is the intensity, 0.3,

and the color, (1.0 1.0 1.0)

 

 

M

 

Modifies existing lights.

(c:light "M" name [intensity [from [to [color

[shadowmapsize [hotspot [falloff [shadowsoftness

[shadow [shadowobjects [month [day [hour [minute

[daylight [latitude [longitude

[attenuation]]]]]]]]]]]]]]]]]])

The arguments for the Modify mode are described in the following table:

LIGHT--"M" mode arguments

Argument Data type Description Default

name STR Unique light name None

intensity REAL A real number from 0.0 to the default maximum Based on attenuation

from LIST Light location Current look-from point

to LIST Light target Current look-at point

color LIST Any RGB triplet 1.0, 1.0, 1.0

shadowmapsize INT Integer from 0 to 4096 (the size, in pixels, of one side of the shadow map) 0

hotspot REAL Angle of the brightness beam in degrees (must be in the range of 1-160) 44.0

falloff REAL Angle that includes the rapid decay area, in degrees (must be in the range 0-160 and greater than the hotspot value) 45.0

shadowsoftness REAL Real number in the range 0.0- 10.0 0.0

shadow STR Shadow-casting toggle. Valid values are: "off" -no shadows and "on" -cast shadows 0.0

shadowobjects ENAME A selection of objects that bound the shadow maps 0.0

month INT Integer from 1 to 12 9

day INT Integer from 1 to 31 21

hour INT Integer from 0 to 24 15

minute INT Integer from 0 to 59 0

daylight STR Daylight savings toggle. Valid values are: "off" -no daylight savings and "on" -daylight savings "off"

latitude REAL Real number in the range 0 -90 37.62

longitude REAL Real number in the range 0 -180 122.37

timezone INT Integer from -12 to 12, representing the hours behind Greenwich Mean Time (GMT) 8 (PST)

attenuation INT 0 = no attenuation

1 = inverse linear attenuation

2 = inverse square attenuation 1

The arguments hotspot and falloff apply only to spotlights. You must pass them as nil when you create a new distant light.

If an argument is nil or has been omitted at the end of the argument list, it retains its current value. If an argument doesn't apply to the kind of light you are modifying, pass it as nil--or omit if located at the end of the argument list.

For example, the following code changes the color of the distant light named D1 to blue:

(c:light "M" "D1" nil nil nil '(0.0 0.0 1.0))

Link to comment
Share on other sites

Thanks for the replies, papagyi and Patrick. I can't find anything on Accessing Externally Defined Commands in the 2008 helpfiles. So much has changed in the latest versions of Autocad.

 

I realized, however, there's away to work around the problem. It is possible to save sun conditions in a view and it's also possible to restore a view in a scriptfile. So what I'll do is make an empty drawing with views for the sun conditions on relevant dates and times, write the scriptfile and then use the drawing to insert a 3d-model of a project everytime I need to do sunstudies. Not exactly what I had in mind but as long as it works...

 

Unless someone comes up with a better idea, of course ;-)

Link to comment
Share on other sites

You're welcome, you might just go ahead and try entering (c:light "A") at the command prompt and see if it returns a value. If it does then do a search for (c:light "A") in the help system. Hopefully it will find something.

Link to comment
Share on other sites

  • 3 weeks later...

Well, (C:light"A") is not recognized. But the scriptfile works and it goes like this:

 

layer f dec*,mar*,jun* t jun08

 

view r 21jun08 render high r 640 480 y C:\sun/21_juni_08_uur.jpg

layer f dec*,mar*,jun* t jun10

 

view r 21jun10 render high r 640 480 y C:\sun/21_juni_10_uur.jpg

layer f dec*,mar*,jun* t jun12

 

view r 21jun12 render high r 640 480 y C:\sun/21_juni_12_uur.jpg

etc...

 

The layer line is meant to display a text in the image with date and time. For some reason I couldn't save date and time in a view if the view was parallel so I used perspective view with lenslenghth 600, which seems to be a kind of maximum, and looks close enough to a parallel projection.

 

It's been a bit of work to make all the views and layers but now that it works it does the job in a matter of minutes (depending, of course, also on the complexity of the model).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...