Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, I facing some problems, I did manage to get the information that I want using code 1 as below
CODE 1
Dim partDoc As PartDocument = ThisApplication.ActiveDocument 'get 3d solid Dim sb As SurfaceBody = partDoc.ComponentDefinition.SurfaceBodies.Item(1) 'get custom user coordinate system Dim ucs As UserCoordinateSystem = partDoc.ComponentDefinition.UserCoordinateSystems(1) 'create a list of points (for sorting) Dim vPoints As New List(Of Point) 'get the transformation matrix from the usc (what it takes to translate from user ucs to origin) Dim mat As Matrix = ucs.Transformation 'invert the matrix (what it takes to translate from origin to user ucs) mat.Invert() 'cycle through all the points For Each vert As Vertex In sb.Vertices 'get the point data from the vertex Dim p As Point = vert.Point 'invert translate the point data (from origin to user ucs) p.TransformBy(mat) 'add translated point to collection vPoints.Add(p) Next Dim tg = ThisApplication.TransientGeometry 'create empty min and max points Dim minPoint As Point = tg.CreatePoint(0, 0, 0) Dim maxPoint As Point = tg.CreatePoint(0, 0, 0) 'sort points based on x values, and get lowest and highest value vPoints.Sort(Function(x, y) x.X.CompareTo(y.X)) minPoint.X = vPoints.First.X maxPoint.X = vPoints.Last.X 'sort points based on y values, and get lowest and highest values vPoints.Sort(Function(x, y) x.Y.CompareTo(y.Y)) minPoint.Y = vPoints.First.Y maxPoint.Y = vPoints.Last.Y 'sort points based on z values, and get lowest and highest values vPoints.Sort(Function(x, y) x.Z.CompareTo(y.Z)) minPoint.Z = vPoints.First.Z maxPoint.Z = vPoints.Last.Z Dim sizeX As Double = Math.Abs(maxPoint.X - minPoint.X) Dim sizeY As Double = Math.Abs(maxPoint.Y - minPoint.Y) Dim sizeZ As Double = Math.Abs(maxPoint.Z - minPoint.Z) Dim outerDim As String = String.Format("{0} x {1} x {2}", sizeX*10, sizeY*10, sizeZ*10) iProperties.Value("Project", "Description") = outerDim MsgBox("Part Dimension:" & outerDim)
The problem is, it does not update my iproperties as shown below.
the value from the msg box for code 1 is already correct, only not updated to the iproperties. is the anywhere to solve these issues?
Solved! Go to Solution.