turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Navigation
- Solid Edge
- Forums
- Blogs
- Knowledge Bases
- Contests
- Groups

- Siemens PLM Community
- Solid Edge
- Solid Edge Forum
- Solid Edge "smart" Watch

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-09-2015 08:40 AM - edited 05-12-2015 08:10 AM

By the topic "Variables with if/then rules" I did remember an old experiment I did in order to know better the .BAS potentiality.

At that time I was working in a big italina Solid Edge VAR.

I did model a digital clock and wanted to display the actual hour.

well now I downloaded a vintage casio watch 3D model, inserted my digital clock and this is the result:

How it works:

- each hour digit is made by a 7 segment display (well except for the decine number of hours)

- each segment is modelled and relationed with the watch base

- the offset of each segment is determined by DIGIT.BAS

- DIGIT.BAS input is an integer number

- each number of the time is calculated by CLOCK.BAS

- the time is calculated by CLOCK.BAS

- CLOCK.BAS input is just a variable named "UPDATE" and it used only to force the time update

If you want to update the time, open the variable table, find the variable named "Update" and change is value to whatever u want (I usually change from 0 to 1 and from 1 to 0, it doesn't really matter what number you write).

sidenote: I have originally wrote CLOCK.BAS with the 24 hours format in mind. The casio model is a 12 hours watch so I decided to convert the result from 24 to 12 hours just with Solid Edge variables.

I will explain the content of DIGIT.BAS and CLOCK.BAS in next posts.

P.S.: Only hours and minutes and AM PM are working, seconds and data need to be implemented.

Francesco

11/07/2015 Update: Now seconds works too, CLOCK.BAS now return also date and day name, haven't created the 3d model for them yet.

12/07/2015 Update: DIGIT.BAS been updated to totally hide a digit, added a new variable called "Format" to handle 12H and 24H mode, also added a "88" mode that show all the segments. CLOCK.BAS updated to handle the "Format" variable.

5 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-09-2015 09:00 AM - edited 05-09-2015 09:10 AM

DIGIT.BAS

Function Seg1(ByVal Input As Double) As Double

SELECT CASE Input

CASE 0

seg1 = -0.1

CASE 1

seg1 = 0.1

CASE 2

seg1 = -0.1

CASE 3

seg1 = -0.1

CASE 4

seg1 = 0.1

CASE 5

seg1 = -0.1

CASE 6

seg1 = -0.1

CASE 7

seg1 = -0.1

CASE 8

seg1 = -0.1

CASE 9

seg1 = -0.1

END SELECT

End Function

Function Seg2(ByVal Input As Double) As Double

SELECT CASE Input

CASE 0

seg2 = -0.1

CASE 1

seg2 = 0.1

CASE 2

seg2 = 0.1

CASE 3

seg2 = 0.1

CASE 4

seg2 = -0.1

CASE 5

seg2 = -0.1

CASE 6

seg2 = -0.1

CASE 7

seg2 = 0.1

CASE 8

seg2 = -0.1

CASE 9

seg2 = -0.1

END SELECT

End Function

Function Seg3(ByVal Input As Double) As Double

SELECT CASE Input

CASE 0

seg3 = -0.1

CASE 1

seg3 = -0.1

CASE 2

seg3 = -0.1

CASE 3

seg3 = -0.1

CASE 4

seg3 = -0.1

CASE 5

seg3 = 0.1

CASE 6

seg3 = 0.1

CASE 7

seg3 = -0.1

CASE 8

seg3 = -0.1

CASE 9

seg3 = -0.1

END SELECT

End Function

Function Seg4(ByVal Input As Double) As Double

SELECT CASE Input

CASE 0

seg4 = 0.1

CASE 1

seg4 = 0.1

CASE 2

seg4 = -0.1

CASE 3

seg4 = -0.1

CASE 4

seg4 = -0.1

CASE 5

seg4 = -0.1

CASE 6

seg4 = -0.1

CASE 7

seg4 = 0.1

CASE 8

seg4 = -0.1

CASE 9

seg4 = -0.1

END SELECT

End Function

Function Seg5(ByVal Input As Double) As Double

SELECT CASE Input

CASE 0

seg5 = -0.1

CASE 1

seg5 = 0.1

CASE 2

seg5 = -0.1

CASE 3

seg5 = 0.1

CASE 4

seg5 = 0.1

CASE 5

seg5 = 0.1

CASE 6

seg5 = -0.1

CASE 7

seg5 = 0.1

CASE 8

seg5 = -0.1

CASE 9

seg5 = 0.1

END SELECT

End Function

Function Seg6(ByVal Input As Double) As Double

SELECT CASE Input

CASE 0

seg6 = -0.1

CASE 1

seg6 = -0.1

CASE 2

seg6 = 0.1

CASE 3

seg6 = -0.1

CASE 4

seg6 = -0.1

CASE 5

seg6 = -0.1

CASE 6

seg6 = -0.1

CASE 7

seg6 = -0.1

CASE 8

seg6 = -0.1

CASE 9

seg6 = -0.1

END SELECT

End Function

Function Seg7(ByVal Input As Double) As Double

SELECT CASE Input

CASE 0

seg7 = -0.1

CASE 1

seg7 = 0.1

CASE 2

seg7 = -0.1

CASE 3

seg7 = -0.1

CASE 4

seg7 = 0.1

CASE 5

seg7 = -0.1

CASE 6

seg7 = -0.1

CASE 7

seg7 = 0.1

CASE 8

seg7 = -0.1

CASE 9

seg7 = -0.1

END SELECT

End Function

DIGIT.BAS contain 7 function.

The function are numbered from seg1 to seg7, one function for each segment that compose a digit.

The function have a number from 0 to 9 as input.

The result of the function is 0.1 or -0.1 depending by the input number.

Follow this schema:

For example to show the number 1 segment 3 and segment 6 allign relation offset must be -0.1 and all other segments allign relation offset must be 0.1

(-0.1 and 0.1 are the offset i give to the segments to be visible and not visible)

So in each function it's coded if the segment must be visible or not for each number from 0 to 9

If you open the variable table you will see the offset valute of the allign relation of each segment being driven by the corresponding function.

The input value is calculated by CLOCK.BAS

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-09-2015 09:08 AM

CLOCK.BAS

Public Function HourDig1(H) As Integer

Dim s

s = CStr(Hour(Now))

If Len(s) = 1 Then

HourDig1 = 0

Else

HourDig1 = CInt(Left(s, 1))

End If

End Function

Public Function HourDig2(H)

HourDig2 = Hour(Now) Mod 10

End Function

Public Function MinDig1(H)

Dim s

s = CStr(Minute(Now))

If Len(s) = 1 Then

MinDig1 = 0

Else

MinDig1 = CInt(Left(s, 1))

End If

End Function

Public Function MinDig2(H)

MinDig2 = Minute(Now) Mod 10

End Function

This file contains 4 function

Function HourDig1 get the current time hour, and if it's 1 digit then it became 0, otherwise the first character of the hour is returned

For example if the actual hour is 9 then it return 0, if it's 14 it return 1

Function HourDig2 get the current time hour, divide it by 10 and return the division rest.

For example if the actual hour is 9 it return 0, if it's 14 it return 4

The other two function are the same but exctract minutes istead of hours.

Francesco

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

05-12-2015 03:01 AM

I haven't found a way inside Solid Edge to automatically update the time every second.

I did try to drive the "Update" variable by the offset value of a button, but I got an error that a variable can't be driven by such dimension.

In the mean time I wrote a little VB6 program that will update the Watch value.

You can find in the latest update with it's source too.

Just open "SEdgeWatch.asm" in Solid Edge run "SEdgeWatch.exe" and press the "Start" button.

There is also buttons to try the 24H, 12H and Test mode.

Enjoy

Francesco

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-03-2016 10:56 AM

This is great! Fantastic job!

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

03-03-2016 11:07 AM

Cadflow wrote:This is great! Fantastic job!

Thanks !

Here it is a new video:

Follow Siemens PLM Software

© 2018 Siemens Product Lifecycle Management Software Inc