Trying to attempt to select a model and have the model move along the sectioning plane when gizmo is activated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
is anyone familiar with Revizto and how you are able to append a pdf to the model and have it follow your sectioning plane along the z axis? i am trying to replicate the same thing in Navisworks using a dwg converted from a pdf. i am new in coding and constantly learning. i have this part of the code where i believe i am implementing it correctly but it is not working as expected. here is the code snippet where i am locking the x and y axis coordinates and when the sectioning gizmo is activated it should snap the selected model to the clipping plane (top plane). then it is monitoring the gizmo moving along the z axis and the model (selected dwg file) and it is expected to move with the clipping plane but it is not moving or snapping to the clipping plane. the dwg stays in the position it is imported at. so my question is can i not have the dwg file move once selected to the clipping plane and then use the sectioning gizmo and move up or down with the file?
// Store the original X and Y
var bbox = _selectedModel.RootItem.BoundingBox();
_originalModelX = (bbox.Min.X + bbox.Max.X) / 2.0;
_originalModelY = (bbox.Min.Y + bbox.Max.Y) / 2.0;
// Snap immediately to the current Z of the top section plane
MoveModelToSectionPlane(_selectedModel, z);
// Start monitoring so the model follows the section plane as it moves
StartSectionMonitor();
// Ensure the view is updated to focus on the moved model
RunOnUIThread(() =>
{
// Select the model in the UI
var selection = new ModelItemCollection();
selection.Add(_selectedModel.RootItem);
_activeDoc.CurrentSelection.CopyFrom(selection);
// Optionally, fit the view to the selection
try
{
dynamic state = Autodesk.Navisworks.Api.ComApi.ComApiBridge.State;
state.InvokeEx("ViewpointFitToSelection");
}
catch { /* Ignore if COM API not available */ }