Difference between pages "ClosestPoints" and "ColorAtPointThruNurb"

From scripting
(Difference between pages)
Jump to: navigation, search
(Created page with " Sub ClosestPoints(Point1 As Variant, Point2 As Variant) Dim SmallestDist As Double SmallestDist = 100000000 Dim WinHH, WinJJ As Integer WinHH = 0: WinJJ = 0 For...")
 
(Created page with " global proc vector colorAtPointThruNurb(string $ObjName, float $UVal, float $VVal) { //Author Nick Pisca 0001d 2009 string $TRel[] = `listRelatives $ObjName`; string $TCon...")
 
Line 1: Line 1:
   
+
  global proc vector colorAtPointThruNurb(string $ObjName, float $UVal, float $VVal) {
Sub ClosestPoints(Point1 As Variant, Point2 As Variant)
+
  //Author Nick Pisca 0001d 2009
 
+
  string $TRel[] = `listRelatives $ObjName`;
  Dim SmallestDist As Double
+
  string $TCon[] = `listConnections $TRel[0]`;
  SmallestDist = 100000000
+
  string $TB[] = `listHistory $TCon[0]`;
  Dim WinHH, WinJJ As Integer
+
string $TBOutput = $TB[2];
WinHH = 0: WinJJ = 0
+
float $CAPArr[2] = `colorAtPoint -o RGB -u $UVal -v $VVal $TBOutput`;
 
+
vector $CAPVec = <<$CAPArr[0], $CAPArr[1], $CAPArr[2]>>;
  For HH = 0 To 1
+
  return $CAPVec;
    For jj = 0 To 1
+
  }
        Point1.Ratio.Value = HH
 
        Point2.Ratio.Value = jj
 
        CATIA.ActiveDocument.Part.UpdateObject Point1
 
        CATIA.ActiveDocument.Part.UpdateObject Point2
 
       
 
        Dim MeasuredDist As Double
 
        Dim CMeas
 
        Set CMeas = TheSPAWorkbench.GetMeasurable(Point1)
 
        MeasuredDist = CMeas.GetMinimumDistance(Point2)
 
       
 
        If MeasuredDist < SmallestDist Then
 
            SmallestDist = MeasuredDist
 
            WinHH = HH
 
            WinJJ = jj
 
        End If
 
    Next jj
 
Next HH
 
 
 
Point1.Ratio.Value = WinHH
 
  Point2.Ratio.Value = WinJJ
 
  End Sub
 
  
  
[[Category:CATIA DP VB]]
+
 
 +
''More information on navigating shader nodes, read pages 133-134 in [http://stores.lulu.com/nickpisca YSYT]. 
 +
[[Category:MEL]]

Latest revision as of 05:15, 22 April 2017

global proc vector colorAtPointThruNurb(string $ObjName, float $UVal, float $VVal) {
//Author Nick Pisca 0001d 2009
string $TRel[] = `listRelatives $ObjName`;
string $TCon[] = `listConnections $TRel[0]`;
string $TB[] = `listHistory $TCon[0]`; 
string $TBOutput = $TB[2];
float $CAPArr[2] = `colorAtPoint -o RGB -u $UVal -v $VVal $TBOutput`;
vector $CAPVec = <<$CAPArr[0], $CAPArr[1], $CAPArr[2]>>;
return $CAPVec;
}


More information on navigating shader nodes, read pages 133-134 in YSYT.