Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit indicator mismatch #4833

Open
nicboone8 opened this issue Dec 18, 2024 · 1 comment
Open

Unit indicator mismatch #4833

nicboone8 opened this issue Dec 18, 2024 · 1 comment
Assignees
Labels
bug Something isn't working coredump Issues that contain a coredump. desktop-app Issues from the desktop app.

Comments

@nicboone8
Copy link

nicboone8 commented Dec 18, 2024

The units indicator reads in when mm is selected.
User settings default unit is set to inches

Zoo.Modeling.App.2024-12-18.16-30-04.mp4
Core Dump

coredump-8256bd43-b9cb-4b4e-bf33-23406ce27959.json

Reference ID: 8256bd43-b9cb-4b4e-bf33-23406ce27959

KCL Code
// Car Wheel
// A sports car wheel with a circular lug pattern and spokes.


// Define constants
// Base units for this model are in inches
lugCount = 5
lugSpacing = 114.3 * mm()
offset = -35 * mm()
backSpacing = 6.38
wheelWidth = 9.5
wheelDiameter = 19
spokeCount = 6
spokeGap = 0.2
spokeAngle = 0.02
spokeThickness = 0.95

// Create the wheel center
lugBase = startSketchOn('XZ')
  |> circle({
       center = [0, 0],
       radius = (lugSpacing + 1.5) / 2
     }, %)
  |> hole(circle({
       center = [0, 0],
       radius = (lugSpacing - 1.5) / 2
     }, %), %)
  |> extrude(wheelWidth / 20, %)

// Extend the wheel center and bore holes to accomidate the lug heads
lugExtrusion = startSketchOn(lugBase, 'END')
  |> circle({
       center = [0, 0],
       radius = (lugSpacing + 1.5) / 2
     }, %)
  |> hole(circle({
       center = [0, 0],
       radius = (lugSpacing - 1.5) / 2
     }, %), %)
  |> extrude(wheelWidth / 10, %)

// Create the circular pattern for the lugs
lugClearance = startSketchOn(lugExtrusion, 'END')
  |> circle({
       center = [lugSpacing / 2, 0],
       radius = 1.2 / 2
     }, %)
  |> patternCircular2d({
       arcDegrees = 360,
       center = [0, 0],
       instances = lugCount,
       rotateDuplicates = true
     }, %)
  |> extrude(-wheelWidth / 10, %)

// Create the circular pattern for the lug holes
lugHoles = startSketchOn(lugBase, 'END')
  |> circle({
       center = [lugSpacing / 2, 0],
       radius = 16 * mm() / 2
     }, %)
  |> patternCircular2d({
       arcDegrees = 360,
       center = [0, 0],
       instances = lugCount,
       rotateDuplicates = true
     }, %)
  |> extrude(-wheelWidth / 20, %)

// Add detail to the wheel center by revolving curved edge profiles
wheelCenterInner = startSketchOn('XY')
  |> startProfileAt([(lugSpacing - 1.5) / 2, 0], %)
  |> yLine(-wheelWidth / 10 - (wheelWidth / 20), %)
  |> bezierCurve({
       to = [-0.4, 0.3],
       control1 = [-0.3, 0],
       control2 = [0, 0.3]
     }, %)
  |> yLineTo(0, %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)
  |> revolve({ axis = 'y' }, %)

wheelCenterOuter = startSketchOn('XY')
  |> startProfileAt([(lugSpacing + 1.5) / 2, 0], %)
  |> yLine(-wheelWidth / 10 - (wheelWidth / 20), %)
  |> bezierCurve({
       to = [0.4, -0.1],
       control1 = [0.3, 0],
       control2 = [0.2, -0.3]
     }, %)
  |> yLineTo(-wheelWidth / 20, %)
  |> lineTo([profileStartX(%), profileStartY(%)], %)
  |> close(%)
  |> revolve({ axis = 'y' }, %)

// Write a function that defines the spoke geometry, patterns and extrudes it
fn spoke(spokeGap, spokeAngle, spokeThickness) {
  // Seperating the spoke base planes
  plane001 = {
    plane = {
      origin = [0.0, 0.0, spokeGap / 2],
      xAxis = [1.0, 0.0, spokeAngle],
      yAxis = [0.0, 1.0, 0.0],
      zAxis = [0.0, 0.0, 1.0]
    }
  }

  // Spoke cross sections
  spokeProfile = startSketchOn(plane001)
    |> startProfileAt([(lugSpacing + 2) / 2, -0.7], %)
    |> bezierCurve({
         to = [
           (wheelDiameter - lugSpacing - 2.9) / 2,
           offset
         ],
         control1 = [
           (wheelDiameter - lugSpacing - 2.9) / 3.5,
           offset / 7
         ],
         control2 = [
           (wheelDiameter - lugSpacing - 2.9) / 4,
           offset / 1.5
         ]
       }, %)
    |> yLine(-wheelWidth / 15, %)
    |> bezierCurve({
         to = [
           -(wheelDiameter - lugSpacing - 2.9) / 2,
           -offset
         ],
         control1 = [
           -(wheelDiameter - lugSpacing - 2.9) / 5,
           -offset / 7
         ],
         control2 = [
           -(wheelDiameter - lugSpacing - 2.9) / 5,
           -offset / 1.5
         ]
       }, %)
    |> lineTo([profileStartX(%), profileStartY(%)], %)
    |> close(%)

  // Circular pattern spokes
  spokePattern = extrude(spokeThickness, spokeProfile)
    |> patternCircular3d({
         axis = [0, 1, 0],
         center = [0, -2000, 0],
         instances = spokeCount,
         arcDegrees = 360,
         rotateDuplicates = true
       }, %)

  return spokePattern
}

spoke(spokeGap, spokeAngle, spokeThickness)
spoke(-spokeGap, -spokeAngle, -spokeThickness)
@nicboone8 nicboone8 added bug Something isn't working coredump Issues that contain a coredump. desktop-app Issues from the desktop app. labels Dec 18, 2024
@nicboone8
Copy link
Author

I just found something else interesting on this one. When I switch the units indicator from in to mm, the part scales down as expected. But then as soon as I make any change to the kcl, the whole part switches back to inches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working coredump Issues that contain a coredump. desktop-app Issues from the desktop app.
Projects
None yet
Development

No branches or pull requests

3 participants