.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Find Clip Id from NonRectang ularViewPo rt Object ID t?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello,
Need help and could not find a solution for it.
I have the ID of non rectangular view port and I need to find the Polyline attached to it.
How do you do that ?
Thanks,
Solved! Go to Solution.
Re: Find Clip Id from NonRectang ularViewPo rt Object ID t?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Find Clip Id from NonRectang ularViewPo rt Object ID t?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
Once you have a viewport ObjectId, use viewport.NonRectClipEntityId (that should be not ObjectId.Null) to get its non-rectangular viewport, see the following code snippet:
transaction.GetObject(viewport.NonRectClipEntityId
-Khoa
Re: Find Clip Id from NonRectang ularViewPo rt Object ID t?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Thanks Khao for your time,
Actually My Problem it the otherway around. I mean I want the PolyLine ObjectId of sorrouding ViewPort (Which I have the ID.
Re: Find Clip Id from NonRectang ularViewPo rt Object ID t?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Alex,
I need the object ID of Polyline which is attached to viewport.
Re: Find Clip Id from NonRectang ularViewPo rt Object ID t?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Colors;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
[assembly: CommandClass(typeof(Rivilis.Lesson))]
namespace Rivilis
{
public class Lesson
{
[CommandMethod("TestViewport")]
public void TestViewport()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
PromptSelectionResult res = ed.GetSelection();
if (res.Status == PromptStatus.OK) {
using (Transaction t = doc.TransactionManager.StartTransaction()) {
foreach (ObjectId id in res.Value.GetObjectIds()) {
Viewport vp = t.GetObject(id, OpenMode.ForRead) as Viewport;
if (vp != null) {
ObjectId idPoly = vp.NonRectClipEntityId;
if (!idPoly.IsNull) {
// ObjectId of polyline
ed.WriteMessage("\nid = {0} NonRectClipEntityId = {1}", id, idPoly);
}
else {
ed.WriteMessage("\nid = {0} Viewport is not clipping with polyline", id);
}
}
else {
ed.WriteMessage("\nid = {0} is not Viewport", id);
}
}
t.Commit();
}
}
}
}
}
http://www.developerfusion.com/tools/convert/cshar
Re: Find Clip Id from NonRectang ularViewPo rt Object ID t?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Alex Thank you so much. That was it.



