News:

Please remember to do a search before you ask a question!

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

Adding Texture To A Convex Surface

Started by lglauberman, August 08, 2025, 11:58:09 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lglauberman

I would like to add a texture to a convex surface. It's basically a dome shaped hemisphere.

The texture could be something as simple as tiny hemispheres, such as .03125" diameter spheres.

Any guidance on the easiest way to accomplish this would be great.

Thanks everyone in advance.
Lawrence Glauberman, LIG
TurboCAD 2024 Platinum, Lightworks
Bambu H2S w/AMS2, QIDI XPlus3

Andy H

Have you got a specific texture in mind, (or link to an example on the internet).  Are you wishing the finish to be the exact same colour are the object (in which case one would use the texture as a bump map). 

In TC there are some textures like Decoration - Rubber1, or Miscellaneous = Leather Couch  for raised dimples.  or Decoration Cavity for recessed dimples (like golf ball).   In the environment folder, there is Background - Image and Scaled image one can modify in a paint program.  If I had a specific colour in mind for the finish, I would alter a copy of an image in a paint program, then apply that.

Lastly, are you wanting to use Visualize or Turbolux. 

lglauberman

A physical texture such as tiny hemispheres. This is not for rendering purposes, I need the texture on the actual part when it's exported as a STEP file.

I've done it before by drawing a ton of tiny spheres but that's painful.
Lawrence Glauberman, LIG
TurboCAD 2024 Platinum, Lightworks
Bambu H2S w/AMS2, QIDI XPlus3

Andy H

#3
Ah.  My mistake.

If I were drawing them. I'd draw a single line of them from edge to just short of the top of dome.  With a hemisphere, this can be done by drawing one and radial copy tool.  I would then Select them all,  and use the radial copy tool to automatically draw the rest of them around the Hemisphere.

One can then add them all at once if required to the main object using the Boolean add - drag selection method, which saves a lot of time.

Of course if there is a special sequence needed like if each column is offset, that's a little bit more work.

Andy H

#4
No idea if this is what your require.  Took me 2 minutes 26 seconds (not including render) using the radial fit copy tool, to copy one sphere from north to south (front view). Selected them all, and used the radial fit copy tool (plan view)  to go around the object. Then Boolean added everything at once.  I'm not the fastest at using TC.

Of course I'm still guessing at your actual requirements.

lglauberman

You're very close, but I need the bumps next to each other. Exactly what you did except about a million of them.
Lawrence Glauberman, LIG
TurboCAD 2024 Platinum, Lightworks
Bambu H2S w/AMS2, QIDI XPlus3

Alvin Gregorio

I'd use full Spheres.  So to ensure no gap between them and the main hemisphere whence 3D_Add'ed.
Using various Copy tools, a quote/unquote million of them actually won't take that long to replicate.  But definitely might be a resource hog and slow down interaction and refresh rate while working with the CAD file.

What is the diameter of the main hemisphere to be?
What is the centre-to-centre spacing of the 0.03125" diameter bumps to be?
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

One last question from me.  Do you need them all next to each other in both directions ?.

If yes.  Sorry.  I already know that the maths involved is way beyond my capabilities. north to south = easy, around at the same time beyond me. 

lglauberman

See attached. I would like a fine bumpy surface on the top and side.

You cannot view this attachment.
Lawrence Glauberman, LIG
TurboCAD 2024 Platinum, Lightworks
Bambu H2S w/AMS2, QIDI XPlus3

nikkipollard

#9
Can you add the file in a 2021 version?
Do you have a picture of the bump pattern, on the round surface?
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Steve Edwards

If this is something you are printing have you tried the "fuzzy skin" setting ? Works very well but you do need to switch it off after use, otherwise everything thereafter ends up with a fuzzy skin. Available in Cura and Bambu slicer
TurboCAD Platinum 2024
NVIDIA RTX 4000
12th Gen Intel(R) Core(TM) i9-12900K   3.20 GHz
Windows 11 Pro (64)
64 GB RAM
Bambu P1S with AMS

nikkipollard

I would go Steve's route.
A simple pattern like this put my computer in a bad mood
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

lglauberman

I use the fuzzy skin in Orca all the time and unfortunately that isn't what I need.

Nikki yes that's what I am looking for but a little finer. I've done it before but it takes forever and yes - the model gets really complex and slow.

I seem to remember a tutorial somewhere about applying a "wrap" to a solid but I can't find it and it was a fairly complex procedure.
Lawrence Glauberman, LIG
TurboCAD 2024 Platinum, Lightworks
Bambu H2S w/AMS2, QIDI XPlus3

Alvin Gregorio

Quote from: lglauberman on August 09, 2025, 07:49:18 AM... it takes forever ...
How much time is too much time?
If this is a one-off, I assume you are willing to invest some time.
If you know exactly what you want in advance, and don't foresee edits, then manually creating the bumps would probably be the way to go, as it would likely result in the most physically accurate .step model.
Or are you looking for a method that you can play with and edit after initially creating the bumps?
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

lglauberman

I said screw it and did the radial copy.

You cannot view this attachment.
Lawrence Glauberman, LIG
TurboCAD 2024 Platinum, Lightworks
Bambu H2S w/AMS2, QIDI XPlus3

Alvin Gregorio

If we turn down the ACIS faceting quality while we're working in the drawing file, the CAD'ing will be much more responsive.  Maybe 60 or so.
  We turn it back up again just before final Saving or Save As... .step
_____
Sidenote:  I seldom work with Degenerative Faceting enabled.  I enable it temporarily for certain reasons, such as Center-of-Circle snapping to a cylindrical object's edge.  My personal preference is for the things to look like the things, and not some watered down representation, while I work.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

lglauberman

No need to turn down ACIS faceting quality in this case because the part still moves and responds without any issue.

In this case, I didn't add the spheres to the convex dome - that keeps the model faster. You can just select all of the spheres and the convex dome and export to a STEP and it'll import into Orca as a single part, with multiple objects.

And I never turn down the ACIS faceting quality, I like my part to look like my part. lol
Lawrence Glauberman, LIG
TurboCAD 2024 Platinum, Lightworks
Bambu H2S w/AMS2, QIDI XPlus3

Alvin Gregorio

Quote from: lglauberman on August 09, 2025, 11:34:10 AMNo need to turn down ACIS faceting quality in this case because the part still moves and responds without any issue.
You must have a better more powerful machine than I do.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

#18
Quote from: Alvin Gregorio on August 09, 2025, 01:03:10 PM
Quote from: lglauberman on August 09, 2025, 11:34:10 AMNo need to turn down ACIS faceting quality in this case because the part still moves and responds without any issue.
You must have a better more powerful machine than I do.

And Mine - funny thing is my machine handles sculptures in Blender (almost half a million facets) with no problem.
If the pattern is really fine - would there be a lot of difference if you used a disc, instead of a sphere?
I used a script to generate that pattern.
The script will distribute any graphic on a dome pattern. It's not perfect because the spacing is not equal in all directions and differs for each ring.
If the built in TC pattern tools don' t work the way I want them to, I like to use scripts because you can experiment with different design options quickly.

Option Explicit

'====================================================================
   '# DESCRIPTION
  ' Copies a graphic on a dome
  ' The graphic needs to be aligned with X and Y - world coordinates
  ' at the bottom centre of the Dome
  ' Dome Radius is the Total Radius of the initial sphere
  ' Select the graphic to copy and run the script

'=====================================================================
const PI = 3.1415926535897932384626433832795
Call Main

'_______________________________________________________________________________
Sub Main
 
Dim HemR,HemH
 HemR = CDbl(InputBox("Dome Radius","",600))
 If HemR=0 Then Exit Sub ' user cancelled
 HemH = CDbl(InputBox("Dome Height","",50))
  If HemH = 0 Then Exit Sub ' user cancelled
dx1 = CDbl(Inputbox("Minimum Horizontal Centres","",30))
 If dx1 = 0 Then Exit Sub ' user cancelled
dy1 = CDbl(Inputbox("Minimum Vertical Centres","",30))
 If dy1 = 0 Then Exit Sub ' user cancelled
 
 Dim da,ch1,dz,dx1,dy1
 Dim AB1, Arclen,Abump,Acent,ab2
 Dim num1,i,num2,j
 Dim ThisR,ThisA,ThisCircum
 Dim g,g2
 Dim gGroup
 
    If Selection.Count = 0 Then
       MsgBox "Please Select the graphic to copy, before running the script"
       Exit Sub
    End If

Dim gfx : Set gfx = Selection(0)

Dim gfxRef
Set gfxRef = gfx.ReferencePoint(True)

 If HemH > HemR Then HemH = HemR-0.5
'add a new empty group
 Set gGroup = ActiveDrawing.Graphics.Add(7)

 da = HemR - HemH
 ch1 = sqr(HemR * HemR - da * da)
 AB1 = asin(ch1 / HemR)
 Arclen = AB1 * HemR
 num1 = Int(Arclen/dy1)
 Acent = AB1/num1
 
 For i = 0 to num1-1
     ThisA = i*Acent + Acent/2+(PI/2-AB1)
     'Radius of the dome at this height
     ThisR = HemR * cos(ThisA)
   
     ThisCircum = 2*PI*(ThisR)
     Num2 = Int(ThisCircum/dx1)
     dz =  HemR * sin(ThisA)
     ab2 = 2*PI/Num2
     
     Set g = gfx.Duplicate
     'Align the graphic
     'Rotate 90 degrees on Z axis
     Call g.RotateAxis(PI/2,0,0,1,gfxRef.X,gfxRef.Y,gfxRef.Z)
    'Rotate on Y axis
     Call g.RotateAxis(-ThisA+PI/2,0,1,0,gfxRef.X,gfxRef.Y,gfxRef.Z)
     'Move to edge of the Dome
     Call g.MoveRelative(ThisR,0,dz-da)
   
  'move the copied graphic to the group graphic
     Call ActiveDrawing.Graphics.Remove(g.Index)
     Call gGroup.Graphics.AddGraphic(g)

          For j = 1 to Num2-1
         'copy graphics around the dome
           Set g2 = g.Duplicate
           Call g2.RotateAxis(j*ab2,0,0,1,gfxRef.X,gfxRef.Y,gfxRef.Z)
         Next
   
 Next
Dim RefP
'Change the reference point of the group.
Set RefP = gGroup.ReferencePoint(True)
  With RefP
  .X = gfxRef.X
  .Y = gfxRef.Y
  .Z = gfxRef.Z
  End With

'add to the undo record
Dim Urec
Set Urec = ActiveDrawing.AddUndoRecord("Dome Pattern")
Urec.AddGraphic gGroup
Urec.Close

ActiveDrawing.ActiveView.Refresh
Set gGroup = Nothing
Set g = Nothing
Set g2 = Nothing
Set RefP = Nothing
Set Urec = Nothing

End sub
 '****************************************************************************************

 
 '****************************************************************************************
 '__some maths functions aren't available in vbscript_______________________
 Public Function Asin(X)

  If X >= 1 or X <= -1 Then
  MsgBox "Asin Error Argument needs to be between -1 and 1" & vbCrlf & "X = " & X
  Asin = 0
  Exit Function
  End If

  Dim a
  a = Atn(X / Sqr(-X * X + 1))
   Asin = a

 End Function
 
 '********************************************************************************************


Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

#19
Quote from: nikkipollard on August 10, 2025, 12:02:38 AMI used a script to generate that pattern.
The script will distribute any graphic in a dome pattern
That worked really cool, Nikki.  Took about 12 minutes for it to run on my machine, with one object selected and the resultant array copy being 23,887 objects.  Pretty cool to watch it generate.
I gotta get into script writing.
  (after I tune up my 3D Printing abilities, I reckon)
I do notice that the resultant group is quite a bit larger than the radius and height I input.  I can experiment to find out why that is.  I suspect it's a Metric/Imperial thing and/or Radians/Degrees.

For us users, I suggest putting the below higher up.  So we don't go through each window entering values, to discover "whoops, I forgot to select something".
Can you make it such that as soon as we run the script, if we have nothing selected, the admonishment pops up?

  If Selection.Count = 0 Then
      MsgBox "Please Select the graphic to copy, before running the script"
      Exit Sub
    End If
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

#20
Quote from: Alvin Gregorio on August 10, 2025, 04:48:49 AM
Quote from: nikkipollard on August 10, 2025, 12:02:38 AMI used a script to generate that pattern.
The script will distribute any graphic in a dome pattern
That worked really cool, Nikki.  Took about 12 minutes for it to run on my machine, with one object selected and the resultant array copy being 23,887 objects.  Pretty cool to watch it generate.
I gotta get into script writing.
  (after I tune up my 3D Printing abilities, I reckon)
I do notice that the resultant group is quite a bit larger than the radius and height I input.  I can experiment to find out why that is.  I suspect it's a Metric/Imperial thing and/or Radians/Degrees.

For us users, I suggest putting the below higher up.  So we don't go through each window entering values, to discover "whoops, I forgot to select something".
Can you make it such that as soon as we run the script, if we have nothing selected, the admonishment pops up?

  If Selection.Count = 0 Then
      MsgBox "Please Select the graphic to copy, before running the script"
      Exit Sub
    End If
Good Point Alvin it is almost instant on my computer so I did not think it would take too long.
How long does this one take?
(don't worry you don't need to draw something first. The only thing I can't do is calculate how many copies you would need for the density

Option Explicit
                                                             

'====================================================================
   '# DESCRIPTION
   'distributes spheres on a Dome using fibonacci sequence

'=====================================================================
const PI = 3.1415926535897932384626433832795


Call Main


'_______________________________________________________________________________
Sub Main
     
'Golden Angle
Dim PHI : PHI = PI * (sqr(5) - 1)
Dim DRad,da,Dheight,BumpR
Dim Num,i,j

DRad = CDbl(InputBox("Dome Radius","",650))
 If Drad = 0 Then Exit Sub ' user cancelled
DHeight = CDbl(InputBox("Dome Height","",50))
 If DHeight = 0 Then Exit Sub ' user cancelled
 Num = CInt(InputBox("Number of copies","",370))
 If Num = 0 Then Exit Sub ' user cancelled
BumpR = CDbl(InputBox("Bump Radius","",10))


 If BumpR = 0 Then Exit Sub ' user cancelled
 
 da = Drad-Dheight
 
 Dim PList
 Set PList = CreateObject("System.Collections.Arraylist")
 Dim S                  'samples for hemisphere
S = (Num/DHeight)* Drad
 
 Dim Y1,CurrentR,Theta,X1,Z1
 
 For i = 0 to S-1
 
 Y1 = DRad * (i / (S - 1))
If Y1 > da Then
 CurrentR = sqr(DRad^2 - Y1^2)
 Theta = i * PHI
 
 z1 = sin(theta) * CurrentR
 
  x1 = cos(theta) * CurrentR
 Call Plist.Add((New PointD)(x1,y1,z1))
End If
 
 Next
 Dim g, gGroup
 Set gGroup = ActiveDrawing.Graphics.Add(7)
 
 Dim P
 For Each P In Plist
 
 Set   g = gGroup.Graphics.Add(, "TCW40SPHERE")
        g.Vertices.Add P.X, P.Y, P.Z
        g.Vertices.Add BumpR+P.X, P.Y, P.Z
        g.Properties.Item("Solid").Value = 1
        g.Properties.Item("$HEMISPHERE").Value = 0
        g.Draw()

 

 Next
 Call gGroup.RotateAxis(PI/2,1,0,0,0,0,0)
 Call gGroup.MoveRelative(0,0,-da)
 dim gref
 Set gref = gGroup.ReferencePoint(True)
 With gref
 .X=0
 .Y=0
 .Z=0
 End with

 

ActiveDrawing.ActiveView.Refresh

End Sub




'________________________________________________________________________________
Class PointD

Public X
Public Y
Public Z

 Public Default Function Init(x1,y1,z1)
    x = x1
    y = y1
    z = z1
  Set Init = Me
  End Function

Public Function FromTcNode(Node)
Dim P
Set P = (New PointD)(Node.X,Node.Y,Node.Z)
Set FromTcNode = P
End Function

End Class





I doubt it is a radians or units problem - It might be a reference point issue
23,887 objects is a lot of copies how small are your bumps?

Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

#21
Quote from: nikkipollard on August 10, 2025, 05:46:45 AM23,887 objects is a lot of copies how small are your bumps?

I was using a copy of the latest file I used for helping Lawrence, which started with his file and his stated bump diameter of 0.03125 (Radius=Ă·2).  (Saved as new sequentially numbered file Name).  That radius is 2.5.  The height from 0,0,0 (the center of my source object sphere, running your script) is .25

I got out of bed and starting playing with this pretty early in the morning; didn't get a full night's sleep.  Maybe I entered something wrong.  I think I might have entered 2.5 for the Height (decimal in wrong spot)

==================
EDIT:  I see one other error I made:  The source object (sphere) at 0,0,0 is at the same location the middle-center of the base of Lawrence's object is; but that is not the base of the hemispherical top of the object.
   I think I should get some sleep before I go at this again.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Alvin Gregorio

Quote from: nikkipollard on August 10, 2025, 05:46:45 AMHow long does this one take?
It instantly returned "Script playback complete", with no error.
However, no result.  No new objects.  Nothing in the Undo list.

BTW-- What is the "Number of copies" input supposed to do?
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

Quote from: Alvin Gregorio on August 10, 2025, 06:24:01 AM
Quote from: nikkipollard on August 10, 2025, 05:46:45 AMHow long does this one take?
It instantly returned "Script playback complete", with no error.
However, no result.  No new objects.  Nothing in the Undo list.

BTW-- What is the "Number of copies" input supposed to do?

It should be the number of spheres on the Dome
Is there something at 0,0,0?
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

Quote from: nikkipollard on August 10, 2025, 09:30:24 AMIs there something at 0,0,0?
Yes.  The sphere that has a diameter of 0.03125 has its center at 0,0,0.
That sphere center is 0.25 lower in the Z direction than the apex of the hemisphere (apex of hemisphere is at Z=+0.25)
The 2.5_radius hemisphere's center-point is -2.25 on the Z axis.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

#25
I am confused try running the script without changing parameters.
The example should give you something like this.
Units and angles should be irrelevant.
The Algorithm works on "samples"  which is the amount of spheres on the dome.
I don't know how to calculate how many spheres you need to for a high density . So try with a low number and then gauge it from there.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

Quote from: nikkipollard on August 10, 2025, 10:21:50 AMI am confused try running the script without changing parameters.
The example should give you something like this.
Units and angles should be irrelevant.
The Algorithm works on "samples"  which is the amount of spheres on the dome.
I don't know how to calculate how many spheres you need to for a high density . So try with a low number and then gauge it from there.
Nikki,
Are we referring here to your first script, which had "Minimum Horizontal Centres" and "Minimum Vertical Centres"?
Or your second, which replaced those with "Number of copies" and "Bump Radius" ?
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Brandon Meyer

I am guessing there is no way to do actual, physical displacement using image files and turbolux or visualize or it would have been mentioned. I thought I have seen people are able to use image textures to drive displacement in fusion 360 but I am not positive how they are doing it or if it is the surfacing part of the program. In Blender you can do that to the actual mesh but then it is a mesh and not a step file. Turbolux allows bump it seems but no way to apply anything. It would be neat and versatile for creating actual textures on objects.
TC Pro Platinum 2025, 2020, 2016, 2015, v18, v14. TC Deluxe v19. Alibre Design Expert v28. Blender 4.3. Ender 5s1 enclosed printers. Revopoint MetroX, Range1, Pop2 3d scanners.
Home pc Ryzen 7 3700x 32gb Ram Rtx2060 Super. Shop pc Ryzen 9 3900x 64gb Ram Rtx2060 Super.

nikkipollard

Quote from: Alvin Gregorio on August 10, 2025, 10:29:14 AM
Quote from: nikkipollard on August 10, 2025, 10:21:50 AMI am confused try running the script without changing parameters.
The example should give you something like this.
Units and angles should be irrelevant.
The Algorithm works on "samples"  which is the amount of spheres on the dome.
I don't know how to calculate how many spheres you need to for a high density . So try with a low number and then gauge it from there.
Nikki,
Are we referring here to your first script, which had "Minimum Horizontal Centres" and "Minimum Vertical Centres"?
Or your second, which replaced those with "Number of copies" and "Bump Radius" ?

Sorry for the confusion Alvin. The Scripts are completely different. The second script is not an update to the first one. The pattern is completely different based on the Fibonacci sequence. (I Googled the algorithm) - The spheres are evenly spaced.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

Weird that absolutely nothing happens when I run the (latest) script
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

#30
Quote from: Alvin Gregorio on August 10, 2025, 08:30:24 PMWeird that absolutely nothing happens when I run the (latest) script

I wonder if they have changed the way spheres are drawn in recent versions. unless you set the number of copies to 1.
Try this one. You do need a graphic to copy.
Option Explicit
 
'====================================================================
   '# DESCRIPTION
   'distributes a graphic on a Dome using fibonacci sequence
  ' select the graphic and run the script

'=====================================================================
const PI = 3.1415926535897932384626433832795


Call Main


'_______________________________________________________________________________
Sub Main
     
'Golden Angle
Dim PHI : PHI = PI * (sqr(5) - 1)
Dim DRad,da,Dheight,BumpR
Dim g, gGroup,g2,g3
Dim Num,i,j

 If Selection.Count = 0 Then
MsgBox "Please Select a graphic before running the script"
Exit Sub
 End If

 Dim gfx : Set gfx = Selection(0)
 Set g = gfx.Duplicate
 dim gfxRef
 Set gfxRef = g.ReferencePoint(True)

 dim xa,ya,za
 xa = gfxref.x
 ya = gfxref.Y
 za = gfxref.z

Call g.MoveAbsolute(0,0,0,xa,ya,za)

 
DRad = CDbl(InputBox("Dome Radius","",650))
 If Drad = 0 Then Exit Sub ' user cancelled
DHeight = CDbl(InputBox("Dome Height","",50))
 If DHeight = 0 Then Exit Sub ' user cancelled
 Num = CInt(InputBox("Number of copies on the dome","",50))
 If Num = 0 Then Exit Sub ' user cancelled
 
 da = Drad-Dheight
 
 Dim PList
 Set PList = CreateObject("System.Collections.Arraylist")
 Dim S                  'samples for hemisphere
S = (Num/DHeight)* Drad
 
 Dim Y1,CurrentR,Theta,X1,Z1
 
 For i = 0 to S-1
 Y1 = DRad * (i / (S - 1))
 
 If Y1 > da Then
 CurrentR = sqr(DRad^2 - Y1^2)
 Theta = i * PHI
 
 z1 = sin(theta) * CurrentR
 x1 = cos(theta) * CurrentR
 Call Plist.Add((New PointD)(x1,y1,z1))
End If
 
 Next
 
 Set gGroup = ActiveDrawing.Graphics.Add(7)
 gGroup.Vertices.UseWorldCS = True
Dim RotatedPs
Call RotatePointSX(PList,PI/2, (New PointD)(0,0,0),RotatedPs)
 
 Dim P
 For Each P In RotatedPs
 Set g2 = g.Duplicate
 Dim Zrot,Yrot,db
    zrot =  atan2(p.y,p.x)
    db = sqr(p.x^2+p.y^2)
    yrot = PI/2 - atn(p.z/db)
    Call g2.RotateAxis(yrot,0,1,0,0,0,0)
    Call g2.RotateAxis(zrot,0,0,1,0,0,0)
    Call g2.MoveAbsolute(P.X,P.Y,P.Z,0,0,0)
    Call ActiveDrawing.Graphics.Remove(g2.Index)
    Call gGroup.Graphics.AddGraphic(g2)


 Next

 Call gGroup.MoveRelative(xa,ya,za-da)
 dim gref
 Set gref = gGroup.ReferencePoint(True)


 With gref
 .X = xa
 .Y = ya
 .Z = za
 End with

 
g.Delete
ActiveDrawing.ActiveView.Refresh

End Sub
'*********************************************************************************
Function atan2(ys, xs)
' from the Draw Arrows tip
' by Jim Deutch, Syracuse, New York
Dim theta
 
    If xs <> 0 Then
        theta = Atn(ys / xs)
        If xs < 0 Then
            theta = theta + pi
        End If
    Else
        If ys < 0 Then
            theta = 3 * pi / 2 '90
        Else
            theta = pi / 2 '270
        End If
    End If
atan2 = theta
End Function
'************************************************************************************


Sub RotatePointSX(ByVal PTS,ByVal Angle, ByVal RefP,ByRef newPoints)
  'Rotates Points on the X axis
  Dim x1,y1,z1,x2,y2,z2,P2,cosa,sina,i
    ReDim newPoints(PTS.Count-1)
     cosa = cos(Angle)
     sina = sin(Angle)
   
   For i = 0 To PTS.Count-1
    x1 = PTS(i).x - RefP.X
    y1 = PTS(i).Y - RefP.Y
    z1 = PTS(i).z - RefP.Z
 
    x2 = x1
    y2 = y1 * cosa - z1 * sina
    z2 = y1 * sina + z1 * cosa
 
  Set P2 = New PointD
      With P2
      .x = x2 + RefP.X
      .y = y2 + RefP.y
      .z = z2 + RefP.Z
      End With
   
    Set newPoints(i) = P2
    Next

End Sub


'*************************************************************************


'________________________________________________________________________________
Class PointD
'Seems to work a lot faster then TC vertex
Public X
Public Y
Public Z

 Public Default Function Init(x1,y1,z1)
    x = x1
    y = y1
    z = z1
  Set Init = Me
  End Function

End Class




Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

Quote from: nikkipollard on August 10, 2025, 09:04:40 PMTry this one. You do need a graphic to copy.
That worked a little bit.
I ran it on: a 3D Point object; a Line object; and a Sphere object.  All with sizes of 1 (inch), including the Sphere has a 1 (inch) diameter.
  They each resulted in 1 copy, the copy object being in the same location as the source object.

I kept the default Values when running the script.

The copy action does not list in the Undo Record.  No action is listed in Undo, pertaining to having run this script.  [EDIT] I see you purposely eliminated the Undo Record in this test run.

Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

Quote from: Alvin Gregorio on August 11, 2025, 01:55:40 AM
Quote from: nikkipollard on August 10, 2025, 09:04:40 PMTry this one. You do need a graphic to copy.
That worked a little bit.
I ran it on: a 3D Point object; a Line object; and a Sphere object.  All with sizes of 1 (inch), including the Sphere has a 1 (inch) diameter.
  They each resulted in 1 copy, the copy object being in the same location as the source object.

I kept the default Values when running the script.

The copy action does not list in the Undo Record.  No action is listed in Undo, pertaining to having run this script.  [EDIT] I see you purposely eliminated the Undo Record in this test run.



The idea is to quickly cover a domed surface with multiple copies of the graphic. You need at least 50 copies of the graphic to notice the pattern.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

sauerkraut2018

Hello,

it reminds me of a golf ball.  ::)

#-----
Very low knowledge of English - I ask for indulgence - Thanks
Currently installed
TurboCAD Professional 32-bit V.17.2.77.1
TurboCAD 2016 ProPlatinum 64-bit V23.2-61.2 engl.
TurboCAD 2021 Platinum 64-bit V28.0 B.82.3 de.
#-----

Alvin Gregorio

Quote from: nikkipollard on August 11, 2025, 06:41:11 AMThe idea is to quickly cover a domed surface with multiple copies of the graphic. You need at least 50 copies of the graphic to notice the pattern.
?
Nikki, can you provide me a .tcw file that has the source object and a successful implementation of your script that you are referring to here— the Group object.
In that Reply post, can you also include the Code you used to achieve the above.

Thanks...  I don't know why this isn't working for me.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

Hopefully this is clearer.
I think you changed the copy parameter to 1 and that is why nothing is happening. I should change the wording to occurrences or samples - to align with the algorithm I cribbed from.You cannot view this attachment.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

Nope.  Still doesn't work.  Not in TC 2022 nor v2020
Can you add an Undo Record, so that we can see if that at least records.  ?

Unless you lost your interest— which is cool
.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

I am not sure if the undo record would make any difference. But here goes

Option Explicit
 
'====================================================================
   '# DESCRIPTION
   'distributes a graphic on a Dome using fibonacci sequence
  ' select the graphic and run the script

'=====================================================================
const PI = 3.1415926535897932384626433832795
Call Main

'_______________________________________________________________________________
Sub Main
     
'Golden Ratio
Dim PHI : PHI = PI * (sqr(5) - 1)
Dim DRad,da,Dheight,BumpR
Dim g, gGroup,g2,g3
Dim Num,i,j

 If Selection.Count = 0 Then
MsgBox "Please Select a graphic before running the script"
Exit Sub
 End If

 Dim gfx : Set gfx = Selection(0)
 Set g = gfx.Duplicate
 dim gfxRef
 Set gfxRef = g.ReferencePoint(True)

 dim xa,ya,za
 xa = gfxref.x
 ya = gfxref.Y
 za = gfxref.z
 Call g.MoveAbsolute(0,0,0,xa,ya,za)
 Set gfxRef = Nothing
 DRad = CDbl(InputBox("Dome Radius","",650))
 If Drad = 0 Then Exit Sub ' user cancelled
 DHeight = CDbl(InputBox("Dome Height","",50))
 If DHeight = 0 Then Exit Sub ' user cancelled
 Num = CInt(InputBox("Number of instances on the dome","",50))
 If Num = 0 Then Exit Sub ' user cancelled
 
 da = Drad-Dheight
 
 Dim PList
 Set PList = CreateObject("System.Collections.Arraylist")
 Dim S                  'samples for hemisphere
 S = (Num/DHeight)* Drad
 
 Dim Y1,CurrentR,Theta,X1,Z1
 
 For i = 0 to S-1
     Y1 = DRad * (i / (S - 1))
        If Y1 >= da Then
         CurrentR = sqr(DRad^2 - Y1^2)
         Theta = i * PHI
         z1 = sin(theta) * CurrentR
         x1 = cos(theta) * CurrentR
         Call Plist.Add((New PointD)(x1,y1,z1))
        End If
  Next
 
 Set gGroup = ActiveDrawing.Graphics.Add(7)
 gGroup.Vertices.UseWorldCS = True
 Dim RotatedPs
 Call RotatePointSX(PList,PI/2, (New PointD)(0,0,0),RotatedPs)
 
 Dim P
 For Each P In RotatedPs
 Set g2 = g.Duplicate
 Dim Zrot,Yrot,db
    zrot =  atan2(p.y,p.x)
    db = sqr(p.x^2+p.y^2)
   yrot = PI/2 - atn(p.z/db)
    Call g2.RotateAxis(PI/2,0,0,1,0,0,0)
    Call g2.RotateAxis(yrot,0,1,0,0,0,0)
    Call g2.RotateAxis(zrot,0,0,1,0,0,0)
    Call g2.MoveAbsolute(P.X,P.Y,P.Z,0,0,0)
    Call ActiveDrawing.Graphics.Remove(g2.Index)
    Call gGroup.Graphics.AddGraphic(g2)
 Next

 Call gGroup.MoveRelative(xa,ya,za-da)
 dim gref
 Set gref = gGroup.ReferencePoint(True)

 With gref
 .X = xa
 .Y = ya
 .Z = za
 End with

g.Delete

Dim Urec: Set Urec = ActiveDrawing.AddUndoRecord("Distributed Graphic")
  Urec.AddGraphic gGroup
  Urec.Close

ActiveDrawing.ActiveView.Refresh
Set gfx = Nothing
Set g = Nothing
Set pList = Nothing
Set gGroup = Nothing
Set gRef = Nothing
Set Urec = Nothing

End Sub
'*********************************************************************************
Function atan2(ys, xs)
' from the Draw Arrows tip
' by Jim Deutch, Syracuse, New York
Dim theta
 
    If xs <> 0 Then
        theta = Atn(ys / xs)
        If xs < 0 Then
            theta = theta + pi
        End If
    Else
        If ys < 0 Then
            theta = 3 * pi / 2 '90
        Else
            theta = pi / 2 '270
        End If
    End If
atan2 = theta
End Function
'************************************************************************************


Sub RotatePointSX(ByVal PTS,ByVal Angle, ByVal RefP,ByRef newPoints)
  'Rotates Points on the X axis
  Dim x1,y1,z1,x2,y2,z2,P2,cosa,sina,i
    ReDim newPoints(PTS.Count-1)
     cosa = cos(Angle)
     sina = sin(Angle)
   
   For i = 0 To PTS.Count-1
    x1 = PTS(i).x - RefP.X
    y1 = PTS(i).Y - RefP.Y
    z1 = PTS(i).z - RefP.Z
 
    x2 = x1
    y2 = y1 * cosa - z1 * sina
    z2 = y1 * sina + z1 * cosa
 
  Set P2 = New PointD
      With P2
      .x = x2 + RefP.X
      .y = y2 + RefP.y
      .z = z2 + RefP.Z
      End With
   
    Set newPoints(i) = P2
    Next

End Sub

'*************************************************************************

'________________________________________________________________________________
Class PointD
'Seems to work a lot faster then TC vertex
Public X
Public Y
Public Z

 Public Default Function Init(x1,y1,z1)
    x = x1
    y = y1
    z = z1
  Set Init = Me
  End Function

End Class

Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

#38
Quote from: nikkipollard on August 11, 2025, 10:06:20 PMI am not sure if the undo record would make any difference. But here goes
It copied one copy, in place.  No Undo record.

The previous attempt with the previous script also copied one copy, in place.  I hadn't noticed it til now.

Maybe it's a TurboCAD version difference issue.

Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

#39
I think it is fairly safe to say that the SDK hasn't changed that much,- not since the internet explorer palette was removed.
The only thing I can think of Is that the Array list is not working on your machine. (That is a windows thing)
Try running this

dim Lis
Set Lis = CreateObject("System.Collections.ArrayList")

With Lis
.Add "Banana"
.Add "Apple"
.Add "Orange"
.Add "Grapes"
.Add "Plum"


End With

MsgBox Lis(2)

If a msgbox doesn't popup the array list will be the problem.

and try this instead

Option Explicit
 
'====================================================================
   '# DESCRIPTION
   'distributes a graphic on a Dome using fibonacci sequence
  ' select the graphic and run the script

'=====================================================================
const PI = 3.1415926535897932384626433832795
Call Main

'_______________________________________________________________________________
Sub Main
     
'Golden Angle
Dim PHI : PHI = PI * (sqr(5) - 1)
Dim DRad,da,Dheight,BumpR
Dim g, gGroup,g2,g3
Dim Num,i,j
Dim x2,y2,z2
 If Selection.Count = 0 Then
MsgBox "Please Select a graphic before running the script"
Exit Sub
 End If

 Dim gfx : Set gfx = Selection(0)
 Set g = gfx.Duplicate
 dim gfxRef
 Set gfxRef = g.ReferencePoint(True)

 dim xa,ya,za
 xa = gfxref.x
 ya = gfxref.Y
 za = gfxref.z
 Call g.MoveAbsolute(0,0,0,xa,ya,za)
 Set gfxRef = Nothing
 DRad = CDbl(InputBox("Dome Radius","",650))
 If Drad = 0 Then Exit Sub ' user cancelled
 DHeight = CDbl(InputBox("Dome Height","",50))
 If DHeight = 0 Then Exit Sub ' user cancelled
 Num = CInt(InputBox("Number of instances on the dome","",50))
 If Num = 0 Then Exit Sub ' user cancelled
 
 da = Drad-Dheight
 
 
 
 Dim S                  'samples for hemisphere
 S = (Num/DHeight)* Drad
  ReDim PList(S)
  Dim k : k = 0
 Dim Y1,CurrentR,Theta,X1,Z1
 dim cosa,sina
 cosa = cos(PI/2)
 sina = sin(PI/2)
 For i = 0 to S-1
     Y1 = DRad * (i / (S - 1))
        If Y1 >= da Then
         CurrentR = sqr(DRad^2 - Y1^2)
         Theta = i * PHI
         z1 = sin(theta) * CurrentR
         x1 = cos(theta) * CurrentR
       y2 = y1 * cosa - z1 * sina
       z2 = y1 * sina + z1 * cosa
       Set Plist(K) = (New PointD)(x1,y2,z2)
        k = k+1
       End If
  Next
 ReDim Preserve PList(k-1)

 Set gGroup = ActiveDrawing.Graphics.Add(7)
 gGroup.Vertices.UseWorldCS = True


 Dim P
 For Each P In PList
 Set g2 = g.Duplicate
 Dim Zrot,Yrot,db
    zrot =  atan2(p.y,p.x)
    db = sqr(p.x^2+p.y^2)
   yrot = PI/2 - atn(p.z/db)
    Call g2.RotateAxis(PI/2,0,0,1,0,0,0)
    Call g2.RotateAxis(yrot,0,1,0,0,0,0)
    Call g2.RotateAxis(zrot,0,0,1,0,0,0)
    Call g2.MoveAbsolute(P.X,P.Y,P.Z,0,0,0)
    Call ActiveDrawing.Graphics.Remove(g2.Index)
    Call gGroup.Graphics.AddGraphic(g2)
 Next

 Call gGroup.MoveRelative(xa,ya,za-da)
 dim gref
 Set gref = gGroup.ReferencePoint(True)

 With gref
 .X = xa
 .Y = ya
 .Z = za
 End with

g.Delete

Dim Urec: Set Urec = ActiveDrawing.AddUndoRecord("Distributed Graphic")
  Urec.AddGraphic gGroup
  Urec.Close

ActiveDrawing.ActiveView.Refresh
Set gfx = Nothing
Set g = Nothing
Set gGroup = Nothing
Set gRef = Nothing
Set Urec = Nothing

End Sub
'*********************************************************************************
Function atan2(ys, xs)
' from the Draw Arrows tip
' by Jim Deutch, Syracuse, New York
Dim theta
 
    If xs <> 0 Then
        theta = Atn(ys / xs)
        If xs < 0 Then
            theta = theta + pi
        End If
    Else
        If ys < 0 Then
            theta = 3 * pi / 2 '90
        Else
            theta = pi / 2 '270
        End If
    End If
atan2 = theta
End Function
'************************************************************************************



'*************************************************************************

'________________________________________________________________________________
Class PointD
'Seems to work a lot faster then TC vertex
Public X
Public Y
Public Z

 Public Default Function Init(x1,y1,z1)
    x = x1
    y = y1
    z = z1
  Set Init = Me
  End Function

End Class


Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h