@@ -282,6 +282,10 @@ func (t *Compound) solid() C.struct__topo_solid_t {
282
282
return val
283
283
}
284
284
285
+ func (s * Compound ) IsInside (p Point3 , tol float64 ) bool {
286
+ return bool (C .topo_solid_is_inside (s .solid (), p .val , C .double (tol )))
287
+ }
288
+
285
289
func (t * Compound ) ToShape () * Shape {
286
290
sp := & Shape {inner : & innerShape {val : C .topo_shape_share (t .inner .val .shp )}}
287
291
runtime .SetFinalizer (sp .inner , (* innerShape ).free )
@@ -312,6 +316,10 @@ func (s *Compound) Volume() float64 {
312
316
return float64 (C .topo_solid_volume (s .solid ()))
313
317
}
314
318
319
+ func (s * Compound ) Remove (shp * Shape ) {
320
+ C .topo_compound_remove (s .inner .val , shp .inner .val )
321
+ }
322
+
315
323
func (s * Compound ) Inertia () BBox {
316
324
return BBox {val : C .topo_solid_inertia (s .solid ())}
317
325
}
@@ -328,6 +336,96 @@ func (s *Compound) ExtrudeFromDir(f *Face, d Vector3) int {
328
336
return int (C .topo_solid_extrude_from_dir (s .solid (), f .inner .val , d .val ))
329
337
}
330
338
339
+ func (s * Compound ) ExtrudeWithRotationFromWire (outerWire * Wire , innerWires []* Wire , vecCenter Point3 , vecNormal Vector3 , angleDegrees float64 ) int {
340
+ innerCount := len (innerWires )
341
+ cWires := make ([]C.struct__topo_wire_t , innerCount )
342
+ for i , w := range innerWires {
343
+ cWires [i ] = w .inner .val
344
+ }
345
+
346
+ var cWiresPtr * C.struct__topo_wire_t
347
+ if innerCount > 0 {
348
+ cWiresPtr = & cWires [0 ]
349
+ }
350
+
351
+ return int (C .topo_solid_extrude_with_rotation_from_wire (
352
+ s .solid (), outerWire .inner .val , cWiresPtr , C .int (innerCount ),
353
+ vecCenter .val , vecNormal .val , C .double (angleDegrees )))
354
+ }
355
+
356
+ func (s * Compound ) ExtrudeWithRotationFromFace (face * Face , vecCenter Point3 , vecNormal Vector3 , angleDegrees float64 ) int {
357
+ return int (C .topo_solid_extrude_with_rotation_from_face (
358
+ s .solid (), face .inner .val , vecCenter .val , vecNormal .val ,
359
+ C .double (angleDegrees )))
360
+ }
361
+
362
+ func (s * Compound ) SweepWire (spine * Wire , profiles []* Wire , cornerMode int ) int {
363
+ count := len (profiles )
364
+ cProfiles := make ([]C.struct__topo_wire_t , count )
365
+ for i , w := range profiles {
366
+ cProfiles [i ] = w .inner .val
367
+ }
368
+
369
+ var cProfilesPtr * C.struct__topo_wire_t
370
+ if count > 0 {
371
+ cProfilesPtr = & cProfiles [0 ]
372
+ }
373
+
374
+ return int (C .topo_solid_sweep_wire (
375
+ s .solid (), spine .inner .val , cProfilesPtr , C .int (count ), C .int (cornerMode )))
376
+ }
377
+
378
+ func (s * Compound ) SweepMultiFromVector (profiles []* Shape , path * Shape , makeSolid , isFrenet bool , vec * TopoVector ) int {
379
+ count := len (profiles )
380
+ cProfiles := make ([]* C.struct__topo_shape_t , count )
381
+ for i , p := range profiles {
382
+ cProfiles [i ] = p .inner .val
383
+ }
384
+
385
+ var cProfilesPtr * * C.struct__topo_shape_t
386
+ if count > 0 {
387
+ cProfilesPtr = & cProfiles [0 ]
388
+ }
389
+
390
+ return int (C .topo_solid_sweep_multi_from_vector (
391
+ s .solid (), cProfilesPtr , C .int (count ), path .inner .val ,
392
+ C .bool (makeSolid ), C .bool (isFrenet ), vec .inner .val ))
393
+ }
394
+
395
+ func (s * Compound ) SweepMultiFromWire (profiles []* Shape , path * Shape , makeSolid , isFrenet bool , wire * Wire ) int {
396
+ count := len (profiles )
397
+ cProfiles := make ([]* C.struct__topo_shape_t , count )
398
+ for i , p := range profiles {
399
+ cProfiles [i ] = p .inner .val
400
+ }
401
+
402
+ var cProfilesPtr * * C.struct__topo_shape_t
403
+ if count > 0 {
404
+ cProfilesPtr = & cProfiles [0 ]
405
+ }
406
+
407
+ return int (C .topo_solid_sweep_multi_from_wire (
408
+ s .solid (), cProfilesPtr , C .int (count ), path .inner .val ,
409
+ C .bool (makeSolid ), C .bool (isFrenet ), & wire .inner .val ))
410
+ }
411
+
412
+ func (s * Compound ) SweepMultiFromEdge (profiles []* Shape , path * Shape , makeSolid , isFrenet bool , edge * Edge ) int {
413
+ count := len (profiles )
414
+ cProfiles := make ([]* C.struct__topo_shape_t , count )
415
+ for i , p := range profiles {
416
+ cProfiles [i ] = p .inner .val
417
+ }
418
+
419
+ var cProfilesPtr * * C.struct__topo_shape_t
420
+ if count > 0 {
421
+ cProfilesPtr = & cProfiles [0 ]
422
+ }
423
+
424
+ return int (C .topo_solid_sweep_multi_from_edge (
425
+ s .solid (), cProfilesPtr , C .int (count ), path .inner .val ,
426
+ C .bool (makeSolid ), C .bool (isFrenet ), & edge .inner .val ))
427
+ }
428
+
331
429
func (s * Compound ) Revolve (f * Face , p1 , p2 Point3 , angle float64 ) int {
332
430
return int (C .topo_solid_revolve (s .solid (), f .inner .val , p1 .val , p2 .val , C .double (angle )))
333
431
}
@@ -454,6 +552,80 @@ func (s *Compound) SectionFace(pnt, nor Point3) *Face {
454
552
return p
455
553
}
456
554
555
+ func (s * Compound ) SectionWire (pnt , nor Point3 ) * Wire {
556
+ p := & Wire {inner : & innerWire {val : C .topo_solid_section_wire (s .solid (), pnt .val , nor .val )}}
557
+ runtime .SetFinalizer (p .inner , (* innerWire ).free )
558
+ return p
559
+ }
560
+
561
+ func (c * Compound ) Cut (toCut []* Shape , tol float64 ) * Compound {
562
+ count := len (toCut )
563
+ cShapes := make ([]* C.struct__topo_shape_t , count )
564
+ for i , s := range toCut {
565
+ cShapes [i ] = s .inner .val
566
+ }
567
+
568
+ var cShapesPtr * * C.struct__topo_shape_t
569
+ if count > 0 {
570
+ cShapesPtr = & cShapes [0 ]
571
+ }
572
+
573
+ p := & Compound {inner : & innerCompound {val : C .topo_compound_cut (
574
+ c .inner .val , cShapesPtr , C .int (count ), C .double (tol ))}}
575
+ runtime .SetFinalizer (p .inner , (* innerCompound ).free )
576
+ return p
577
+ }
578
+
579
+ func (c * Compound ) Fuse (toFuse []* Shape , glue bool , tol float64 ) * Compound {
580
+ count := len (toFuse )
581
+ cShapes := make ([]* C.struct__topo_shape_t , count )
582
+ for i , s := range toFuse {
583
+ cShapes [i ] = s .inner .val
584
+ }
585
+
586
+ var cShapesPtr * * C.struct__topo_shape_t
587
+ if count > 0 {
588
+ cShapesPtr = & cShapes [0 ]
589
+ }
590
+
591
+ p := & Compound {inner : & innerCompound {val : C .topo_compound_fuse (
592
+ c .inner .val , cShapesPtr , C .int (count ), C .bool (glue ), C .double (tol ))}}
593
+ runtime .SetFinalizer (p .inner , (* innerCompound ).free )
594
+ return p
595
+ }
596
+
597
+ func (c * Compound ) Intersect (toIntersect []* Shape , tol float64 ) * Compound {
598
+ count := len (toIntersect )
599
+ cShapes := make ([]* C.struct__topo_shape_t , count )
600
+ for i , s := range toIntersect {
601
+ cShapes [i ] = s .inner .val
602
+ }
603
+
604
+ var cShapesPtr * * C.struct__topo_shape_t
605
+ if count > 0 {
606
+ cShapesPtr = & cShapes [0 ]
607
+ }
608
+
609
+ p := & Compound {inner : & innerCompound {val : C .topo_compound_intersect (
610
+ c .inner .val , cShapesPtr , C .int (count ), C .double (tol ))}}
611
+ runtime .SetFinalizer (p .inner , (* innerCompound ).free )
612
+ return p
613
+ }
614
+
615
+ func (c * Compound ) Ancestors (s * Shape , kind int ) * Compound {
616
+ p := & Compound {inner : & innerCompound {val : C .topo_compound_ancestors (
617
+ c .inner .val , s .inner .val , C .int (kind ))}}
618
+ runtime .SetFinalizer (p .inner , (* innerCompound ).free )
619
+ return p
620
+ }
621
+
622
+ func (c * Compound ) Siblings (shape * Shape , kind int , level int ) * Compound {
623
+ p := & Compound {inner : & innerCompound {val : C .topo_compound_siblings (
624
+ c .inner .val , shape .inner .val , C .int (kind ), C .int (level ))}}
625
+ runtime .SetFinalizer (p .inner , (* innerCompound ).free )
626
+ return p
627
+ }
628
+
457
629
func (s * Compound ) ConvertToNurbs () int {
458
630
return int (C .topo_solid_convert_to_nurbs (s .solid ()))
459
631
}
@@ -466,6 +638,112 @@ func TopoCompoundMake(s []Shape) *Compound {
466
638
return & Compound {inner : & innerCompound {val : C .topo_compound_make_compound (& sos [0 ], C .int (len (s )))}}
467
639
}
468
640
641
+ func TopoCompoundMakeText (text string , size float64 , font , fontPath string , kind , halign , valign int , position * TopoPlane ) * Compound {
642
+ cText := C .CString (text )
643
+ defer C .free (unsafe .Pointer (cText ))
644
+
645
+ var cFont * C.char
646
+ if font != "" {
647
+ cFont = C .CString (font )
648
+ defer C .free (unsafe .Pointer (cFont ))
649
+ }
650
+
651
+ var cFontPath * C.char
652
+ if fontPath != "" {
653
+ cFontPath = C .CString (fontPath )
654
+ defer C .free (unsafe .Pointer (cFontPath ))
655
+ }
656
+ c := & Compound {inner : & innerCompound {val : C .topo_make_text (
657
+ cText , C .double (size ), cFont , cFontPath , C .int (kind ),
658
+ C .int (halign ), C .int (valign ), position .inner .val )}}
659
+ runtime .SetFinalizer (c .inner , (* innerCompound ).free )
660
+ return c
661
+ }
662
+
663
+ func TopoCompoundMakeTextWithSpine (text string , size float64 , spine * Wire , planar bool , font , path string , kind , halign , valign int ) * Compound {
664
+ cText := C .CString (text )
665
+ defer C .free (unsafe .Pointer (cText ))
666
+
667
+ var cFont * C.char
668
+ if font != "" {
669
+ cFont = C .CString (font )
670
+ defer C .free (unsafe .Pointer (cFont ))
671
+ }
672
+
673
+ var cPath * C.char
674
+ if path != "" {
675
+ cPath = C .CString (path )
676
+ defer C .free (unsafe .Pointer (cPath ))
677
+ }
678
+
679
+ var cSpine * C.struct__topo_wire_t
680
+ if spine != nil {
681
+ cSpine = & spine .inner .val
682
+ }
683
+
684
+ c := & Compound {inner : & innerCompound {val : C .topo_make_text_with_spine (
685
+ cText , C .double (size ), cSpine , C .bool (planar ), cFont , cPath ,
686
+ C .int (kind ), C .int (halign ), C .int (valign ))}}
687
+ runtime .SetFinalizer (c .inner , (* innerCompound ).free )
688
+ return c
689
+ }
690
+
691
+ func TopoCompoundMakeTextWithSpineAndBase (text string , size float64 , spine * Wire , base * Face , font , path string , kind , halign , valign int ) * Compound {
692
+ cText := C .CString (text )
693
+ defer C .free (unsafe .Pointer (cText ))
694
+
695
+ var cFont * C.char
696
+ if font != "" {
697
+ cFont = C .CString (font )
698
+ defer C .free (unsafe .Pointer (cFont ))
699
+ }
700
+
701
+ var cPath * C.char
702
+ if path != "" {
703
+ cPath = C .CString (path )
704
+ defer C .free (unsafe .Pointer (cPath ))
705
+ }
706
+
707
+ var cSpine * C.struct__topo_wire_t
708
+ if spine != nil {
709
+ cSpine = & spine .inner .val
710
+ }
711
+
712
+ var cBase * C.struct__topo_face_t
713
+ if base != nil {
714
+ cBase = & base .inner .val
715
+ }
716
+
717
+ c := & Compound {inner : & innerCompound {val : C .topo_make_text_with_spine_and_base (
718
+ cText , C .double (size ), cSpine , cBase , cFont , cPath ,
719
+ C .int (kind ), C .int (halign ), C .int (valign ))}}
720
+ runtime .SetFinalizer (c .inner , (* innerCompound ).free )
721
+ return c
722
+ }
723
+
724
+ func TopoCompoundMakeTextWithHeight (text string , size , height float64 , font , fontPath string , kind , halign , valign int , position * TopoPlane ) * Compound {
725
+ cText := C .CString (text )
726
+ defer C .free (unsafe .Pointer (cText ))
727
+
728
+ var cFont * C.char
729
+ if font != "" {
730
+ cFont = C .CString (font )
731
+ defer C .free (unsafe .Pointer (cFont ))
732
+ }
733
+
734
+ var cFontPath * C.char
735
+ if fontPath != "" {
736
+ cFontPath = C .CString (fontPath )
737
+ defer C .free (unsafe .Pointer (cFontPath ))
738
+ }
739
+
740
+ c := & Compound {inner : & innerCompound {val : C .topo_make_text_with_height (
741
+ cText , C .double (size ), C .double (height ), cFont , cFontPath ,
742
+ C .int (kind ), C .int (halign ), C .int (valign ), position .inner .val )}}
743
+ runtime .SetFinalizer (c .inner , (* innerCompound ).free )
744
+ return c
745
+ }
746
+
469
747
type CompoundIterator struct {
470
748
inner * innerCompoundIterator
471
749
}
0 commit comments