i want get viewport type in Layout. so can everybody help me please? Thks
Solved! Go to Solution.
i want get viewport type in Layout. so can everybody help me please? Thks
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
This is found in the Viewport's Xdata:
public static class ViewportExtensions { /// <summary> /// Returns the Viewort type: /// 0 = undefined, /// 1 = Plan, /// 2 = Profile, /// 3 = Section /// </summary> /// <param name="vp"></param> /// <returns></returns> public static short GetViewportType(this Viewport vp) { short vptype = 0; var xArray = vp.XData.AsArray(); int i = -1; foreach (TypedValue tv in xArray) { i++; try { if ((string)tv.Value == "AeccPlanProd50ViewportType") { vptype = (short)xArray[i + 1].Value; break; } } catch { } } return vptype; }
This is found in the Viewport's Xdata:
public static class ViewportExtensions { /// <summary> /// Returns the Viewort type: /// 0 = undefined, /// 1 = Plan, /// 2 = Profile, /// 3 = Section /// </summary> /// <param name="vp"></param> /// <returns></returns> public static short GetViewportType(this Viewport vp) { short vptype = 0; var xArray = vp.XData.AsArray(); int i = -1; foreach (TypedValue tv in xArray) { i++; try { if ((string)tv.Value == "AeccPlanProd50ViewportType") { vptype = (short)xArray[i + 1].Value; break; } } catch { } } return vptype; }
Hi, Is there some cords to get these viewport types by autolisp ?
/// 0 = undefined, /// 1 = Plan, /// 2 = Profile, /// 3 = Section
Hi, Is there some cords to get these viewport types by autolisp ?
/// 0 = undefined, /// 1 = Plan, /// 2 = Profile, /// 3 = Section
Sorry, I mean Is there some codes to get these viewport types by autolisp ?
Sorry, I mean Is there some codes to get these viewport types by autolisp ?
@JanardFugro wrote:Sorry, I mean Is there some codes to get these viewport types by autolisp ?
(defun _GetViewportType (vpEname / vpType)
(cond
((= 1
(setq vpType
(cdr
(cadr
(cadr (assoc -3
(entget vpEname '("AeccPlanProd50ViewportType"))
)
)
)
)
)
)
"Plan"
)
((= 2 vpType) "Profile")
((= 3 vpType) "Section")
(T "Undefined")
)
)
"How we think determines what we do, and what we do determines what we get."
@JanardFugro wrote:Sorry, I mean Is there some codes to get these viewport types by autolisp ?
(defun _GetViewportType (vpEname / vpType)
(cond
((= 1
(setq vpType
(cdr
(cadr
(cadr (assoc -3
(entget vpEname '("AeccPlanProd50ViewportType"))
)
)
)
)
)
)
"Plan"
)
((= 2 vpType) "Profile")
((= 3 vpType) "Section")
(T "Undefined")
)
)
"How we think determines what we do, and what we do determines what we get."
Hi Blckbox,
Thank you for the fast reply.
I am not that good in autolisp programing, can you please explain with a simple example, how can I call this function in any other autolisp command. I tried by selecting a viewport but not worked.
Hi Blckbox,
Thank you for the fast reply.
I am not that good in autolisp programing, can you please explain with a simple example, how can I call this function in any other autolisp command. I tried by selecting a viewport but not worked.
No problem:
(defun c:ListViewportType (/ ss)
(if (setq ss (ssget ":S:E" '((0 . "VIEWPORT"))))
(prompt
(strcat
"\nViewport Type is: "
(_GetViewportType (ssname ss 0))
" \n"
)
)
)
(princ)
)
"How we think determines what we do, and what we do determines what we get."
No problem:
(defun c:ListViewportType (/ ss)
(if (setq ss (ssget ":S:E" '((0 . "VIEWPORT"))))
(prompt
(strcat
"\nViewport Type is: "
(_GetViewportType (ssname ss 0))
" \n"
)
)
)
(princ)
)
"How we think determines what we do, and what we do determines what we get."
@JanardFugro wrote:
Thank you very much BlackBox. It worked well, brilliant work.
You're welcome, @JanardFugro :beer:
Cheers
"How we think determines what we do, and what we do determines what we get."
@JanardFugro wrote:
Thank you very much BlackBox. It worked well, brilliant work.
You're welcome, @JanardFugro :beer:
Cheers
"How we think determines what we do, and what we do determines what we get."
Can't find what you're looking for? Ask the community or share your knowledge.