Jump to content
michaelk

Select door/window with TrackObjectN?

Recommended Posts

Is it possible to use TrackObjectN in a script (not in a tool) to select a window or door object inserted into a wall?  I keep getting a Type 68.

 

Thanks!

Share this post


Link to post
Posted (edited)

Don't know about TrackObjectN, in this instance I don't know if you would really need the traversal specification, but here's a short script that works for doors and windows that are embedded in walls:

Quote

PROCEDURE GetDoorWindow;

VAR

    trackHand:HANDLE;
    trackLoc:POINT3D;

FUNCTION CheckObjCallback(h:HANDLE) : BOOLEAN;

{Provides Callback for selecting Doors and Windows inserted into Walls}

    VAR
    
        recName:STRING;
        parentHand:HANDLE;
        
    BEGIN
        recName:=GetName(GetRecord(h,NumRecords(h)));
        parentHand:=GetParent(h);
        
        IF(((recName='Door') | (recName='Window')) & (GetTypeN(parentHand)=68)) THEN CheckObjCallback:=TRUE;
    END;

BEGIN
    TrackObject(CheckObjCallback,trackHand,trackLoc.x,trackLoc.y,trackLoc.z);
END;

Run(GetDoorWindow);

 

 

Edited by Jesse Cogswell

Share this post


Link to post

Thanks!  That's really helpful.

 

I wonder what the integer that "specifies how to traverse the drawing" means in TrackObjectN?

Share this post


Link to post

It determines how deep the track goes.  If you are tracking objects that are inside of symbols or groups, that's how you would specify it.  Somewhere deep in the function reference it describes the difference between shallow and deep traversal, but I couldn't find it last time I looked.  I remember deep traversal going through all containers (walls, extrudes,sweeps,groups), but don't remember what shallow traversal specifies.

 

Every time I've used TrackObject it's been to track something in design layer or sheet layer space, so no need to traverse at all.  So I just use the standard TrackObject function.

 

The documentation for Vectorscript is often times either very cryptic or straight up missing.  I spent last week delving into the four different procedures/functions for offsetting a polygon and the documentation is laughable.  I finally landed on using OffsetPolyN which offsets a polygon in document units instead of defaulting to millimeters, but doesn't close the resulting poly.  The function reference has no example and just says, "Offsets a polygon or polyline. Uses Parasolid to do it. Equivalent of Voronoy based OffsetPoly."  Which is still better than OffsetPoly, which reads more like a requirement doc than useful documentation: "Offsets a polygon or polyline. Must handle open & closed polys. A positive distance offsets to the outside; negative to the inside. Should remove self-intersecting segments from the result. Should support smooth vs. sharp offsets."

Share this post


Link to post
10 minutes ago, Jesse Cogswell said:

The documentation for Vectorscript is often times either very cryptic or straight up missing.

 

if it wasn't for this forum…

 

Thanks for your help.  

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...