-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Rough changes to make the CadQuery integration work with the customizer * Tweak runCQ * Switched to Anaconda * Cleaned up code * Update CadHub after anaconda Related to #547 * Add final tweaks to CQ customizer * Separated out customizer.json from params.json * Changes after discussing CadHub integration * linting runCQ Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
- Loading branch information
Showing
6 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
app/web/src/helpers/cadPackages/cadQuery/cadQueryParams.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { CadhubParams } from 'src/components/Customizer/customizerConverter' | ||
|
||
interface CadQueryParamsBase { | ||
name: string | ||
initial: number | string | boolean | ||
type?: 'number' | 'string' | 'boolean' | ||
} | ||
|
||
interface CadQueryNumberParam extends CadQueryParamsBase { | ||
type: 'number' | ||
initial: number | ||
} | ||
|
||
interface CadQueryStringParam extends CadQueryParamsBase { | ||
type: 'string' | ||
initial: string | ||
} | ||
|
||
interface CadQueryBooleanParam extends CadQueryParamsBase { | ||
type: 'boolean' | ||
initial: boolean | ||
} | ||
|
||
export type CadQueryStringParams = | ||
| CadQueryNumberParam | ||
| CadQueryStringParam | ||
| CadQueryBooleanParam | ||
|
||
export function CadQueryToCadhubParams( | ||
input: CadQueryStringParams[] | ||
): CadhubParams[] { | ||
return input | ||
.map((param): CadhubParams => { | ||
const common: { caption: string; name: string } = { | ||
caption: '', | ||
name: param.name, | ||
} | ||
switch (param.type) { | ||
case 'number': | ||
return { | ||
type: 'number', | ||
input: 'default-number', | ||
...common, | ||
initial: param.initial, | ||
} | ||
case 'string': | ||
return { | ||
type: 'string', | ||
input: 'default-string', | ||
...common, | ||
initial: param.initial, | ||
} | ||
case 'boolean': | ||
return { | ||
type: 'boolean', | ||
input: 'default-boolean', | ||
...common, | ||
initial: param.initial, | ||
} | ||
} | ||
}) | ||
.filter((a) => a) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters