I have several PCB assemblies that contain through holes and components. These "SIMPLE HOLE" holes have attributes with a string value containing the name of the component they are to be associated with. What I would like to do is define points in the component part for the locations of these holes so that in the future I can wave link these points to make holes in other boards.
What would be the easiest method to get the X and Y coordinates of these holes to a CSYS in the component so that points can be created in the component?
Solved! Go to Solution.
When working in context of an assembly, note that the display part controls the coordinate system. If your hole locations are defined in assembly coordinate space, you can make your board the work part and add (non-associative) points at the given coordinates. When you make the board your display part, you'll find that the points have been transformed to the part coordinate system.
The same can be accomplished through code.
I have the coordinates in the context of the assembly. I need to translate them to coordinates within the component. My thought was to use the planes of the csys in the component(yz and xz) and measure to the hole and then use those measurements to create points in the component file. The planes do not seem to be named though when I use the DatumCsys feature unlike interactive NX I can hover the plane and see what datum of the csys it is(ie, XY Plane of Datum_CSYS(0)).
That approach is more complicated than it needs to be.
When you open the component part, the points will be in the correct locations.
I must be missing something in your explanation.
I tried setting the component as the workpart before creating the unassociative point, but it created it the points at the coordinates in the component and not of the assembly. I used Feature.Location to return the coordinates to make the points. It works as you describe when I do it manually, but I have hundreds of parts to do this to.
It works as you describe when I do it manually, but I have hundreds of parts to do this to.
So it works for you manually, but not through code?
If so, please post the relevant section of your code.
For Each HoleFeature As Feature In HoleList Dim Refdes As String = HoleFeature.GetUserAttributeAsString("maya_pcb_hole_part", NXObject.AttributeType.String, -1) If Refdes = ComponentFromList.Designator Then Dim holelocation As Point3d = HoleFeature.Location Dim NewPoint As NX.Point = Snap.Create.Point(holelocation.X, holelocation.Y, 0) End If Next
The workpart is set higher in the code.
I did solve my issue by moving the WCS to each component origin and then using GTAC code to translate ABS points to WCS.
'Date: 11/18/2010 'Subject: Sample NX Open .NET Visual Basic routine : map point from absolute to wcs ' 'Note: GTAC provides programming examples for illustration only, and 'assumes that you are familiar with the programming language being 'demonstrated and the tools used to create and debug procedures. GTAC 'support professionals can help explain the functionality of a particular 'procedure, but we will not modify these examples to provide added 'functionality or construct procedures to meet your specific needs. Function Abs2WCS(ByVal inPt As Point3d) As Point3d Dim pt1(2), pt2(2) As Double pt1(0) = inPt.X pt1(1) = inPt.Y pt1(2) = inPt.Z ufs.Csys.MapPoint(UFConstants.UF_CSYS_ROOT_COORDS, pt1, _ UFConstants.UF_CSYS_ROOT_WCS_COORDS, pt2) Abs2WCS.X = pt2(0) Abs2WCS.Y = pt2(1) Abs2WCS.Z = pt2(2) End Function