Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
it is possible to make an ilogic code that..
1. ask how you want it to move(X,Y,Z)
2. check if the componemt is ground
3 remove ground
4. move componemt
5. reground if componemt was grounded
6. do 2-5 on all componemt
I found this code but it only move one at the time and it does not offset location but set an location. and ground no matter want .. and it use select ... witch is offen very slow . I want to do it withont select an to all componemt on firstlevel. can anyone help with this in ilogic
'check for selection Dim compOcc As ComponentOccurrence Try compOcc = ThisDoc.Document.SelectSet.Item(1) Catch MessageBox.Show("Please select a component before running this rule.", "iLogic") Return End Try ' remove constraints for the selected component Dim oConstraint As AssemblyConstraint For Each oConstraint In compOcc.Constraints oConstraint.Delete Next Dim uom As UnitsOfMeasure = ThisDoc.Document.UnitsOfMeasure Dim convFactor As Double = uom.ConvertUnits(1.0, uom.LengthUnits, UnitsTypeEnum.kDatabaseLengthUnits) ' Get the current transformation matrix from the occurrence. Dim oTransform As Matrix = compOcc.Transformation X = InputBox("Enter X", "Title", "") Y = InputBox("Enter Y", "Title", "") Z = InputBox("Enter Z", "Title", "") ' Move the occurrence ignoring any constraints. oTransform.SetTranslation(ThisApplication.TransientGeometry.CreateVector(X*convFactor, Y*convFactor, Z*convFactor)) compOcc.SetTransformWithoutConstraints(oTransform) ' ground the component compOcc.Grounded = True
Solved! Go to Solution.