TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Kerry on October 05, 2005, 02:25:29 AM

Title: [Specifications] Layer Set Function
Post by: Kerry on October 05, 2005, 02:25:29 AM
[Specifications] Layer Set Function.


1: }

2: }

3: }

4: }

5: }

6: }

7: }

8: }

9: }

10: }

11: }

12: }

13: }

?? What are the specifications .

PS : No Code Please untill the specifications are agreed upon.

[added]

[Specifications] Layer Set Function.

Possible Parameters :

Assertions :

Associated Assertions :

Actions:

Return :
Layer ObjectID or NIL

Unresolved Design querys :


Do we work to these 2 scenarios
Either :


.. any others ??
[/added]

[update] to suit input [/update]
Title: Re: [Specifications] Layer Set Function
Post by: Kerry on October 05, 2005, 02:34:10 AM
I am a firm believer that most code writes itself if the specifications and then pseudocode are written properly.

As with all problem solving, the quality of the question in part determines the quality of the answer.

Please note that the title is NOT a true description of the brief. Layer Set Function could mean anything <well, almost>


It would be nice if there was also some input from other than the usual suspects .. :)
Title: Re: [Specifications] Layer Set Function
Post by: CAB on October 05, 2005, 08:10:10 AM
[Specifications] Layer Set Function.

1: Determine if the layer exist

2: if it exist then thaw, unlock, turn on, set current

3: if it does not exist MAKE it, options are name, color, linetype

4: make sure the options are valid or catch the error

{good morning} :-)
Title: Re: [Specifications] Layer Set Function
Post by: MP on October 05, 2005, 08:18:51 AM
Addendum: Add a flag to indicate whether the proposed layer name must pass (snvalid layername 0|1) test(s).
Title: Re: [Specifications] Layer Set Function
Post by: Keith™ on October 05, 2005, 08:33:58 AM
To begin with I believe it is imperitive to determine if the layer exists, then you can verify whether or not the layer is locked, off, or frozen (a locked, off or frozen current layer is not a good thing). That being said, if this is going to be a true "layer set function", we probably don't need to create the layer if it does not exist, rather it should return the current layer if it exists or nil if it does not.
I suggest a wrapper function for activex as well, thus the set layer command could be used in both plain lisp and vlisp.
Now perhaps I may be looking too deeply into the function, but aside from the regular "set layer" functionality (if that is indeed the purpose) why not have the ability to set the properties of the layer, those properties being ... current, color, name, linetype, lineweight, plot, noplot, lock, unlock, freeze, thaw, on, off. i.e. (LayerSet "somelayer" "current" nil) or (LayerSet "somelayer" "name" "differentname")

It just occured to me that we could use constants to define the differing states ...
vlCurrent
vlName
vlPlot
etc ....
Title: Re: [Specifications] Layer Set Function
Post by: SMadsen on October 05, 2005, 10:09:44 AM
For LayerSet calling function:

1: ...

2: ...

n: Record current layer

n+1: Call LayerSet

n+2: If LayerSet then add current layer to history

n+3: Provide LayerSetPrevious(history) option

n+4: ...
Title: Re: [Specifications] Layer Set Function
Post by: Hangman on October 05, 2005, 10:10:34 AM
Uhh...  Yea...  What they said.   :-)
Title: Re: [Specifications] Layer Set Function
Post by: Kerry on October 05, 2005, 10:24:32 AM
Quote
... title is NOT a true description of the brief. Layer Set Function could mean anything <well, almost>

Title: Re: [Specifications] Layer Set Function
Post by: LE on October 05, 2005, 10:42:25 AM
I am a firm believer that most code writes itself if the specifications and then pseudocode are written properly.

I must admit, I never had followed any pseudocode....  :-(
Title: Re: [Specifications] Layer Set Function
Post by: Kerry on October 05, 2005, 10:45:46 AM
Hi Louis, you probably do yours in your head, just sitting down quietly and thinking through a problem and making notes is a form of code design.
Title: Re: [Specifications] Layer Set Function
Post by: Jürg Menzi on October 05, 2005, 03:34:53 PM
Don't forget to check VP layer status...
Title: Re: [Specifications] Layer Set Function
Post by: Crank on October 05, 2005, 05:38:21 PM
.. and the description...
Title: Re: [Specifications] Layer Set Function
Post by: Bob Wahr on October 05, 2005, 06:23:50 PM
Quote
... title is NOT a true description of the brief. Layer Set Function could mean anything <well, almost>
In it's basest form,If it is essential that the layer exist and be set then baseOptimally if the end result is to have a specific layer with the current properties needs to be set currentIt could be much, much different depending on what actually is desired/required.
Title: Re: [Specifications] Layer Set Function
Post by: Kerry on October 05, 2005, 06:53:32 PM
Quote
It could be much, much different depending on what actually is desired/required.

The idea of the thread is to find out what people think IS required from a routine like this. If YOU were contracting to have the code written what would you want the routine to do ? explicitly. not HOW just WHAT.
Title: Re: [Specifications] Layer Set Function
Post by: Bob Wahr on October 05, 2005, 07:25:31 PM
I guess then that if I were contracting I would want the third option I listed along with additional functions to

a) get current layer state
b) reset to layer state obtained with 'a'
Title: Re: [Specifications] Layer Set Function
Post by: Kerry on October 08, 2005, 01:26:35 AM
Refer to the original post for Updates :

Any more comments ??