Jump to content
Developer Wiki and Function Reference Links ×

Pulling and assigning record fields to/from doors/windows


SamIWas

Recommended Posts

With the lighting device, I can just use SetRField and GetRField to get and set info for the lighting device.  With door, this doesn't seem to work.  As a test, I used GetRField(h,'Door','2DLeafClass') and GetRField(h,'Door','2D Leaf Class').  but neither works.  Is there different way to get and set door info via script?

 

EDIT:  I have found that it works when the door is not in a  wall.  But, once the door is placed in a wall, I can no longer get the script to pull info from it.  Surely there is a way.

Edited by SamIWas
Link to comment
Just now, MullinRJ said:

Are you sure you have a handle to the Door and not the Wall?

 

Raymond

 The test script is set to give me an alert box with the handle.  If I put the door alone in the drawing, it returns a series of numbers.  When I put the door in the wall, and select only the door, I get a blank.

Link to comment

Using: Message(GetTypeN(FSActLayer));

 

If I select a free standing Door I get type 86 (Plug-In object).

 

If I select a a Door in a Wall I get type 68 (Wall object).

 

To see the Door on a test wall I have in an open document, I needed to use:

Message(GetTypeN(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(FIn3D(FSActLayer))))))))));

 

As you can see, the door object is deep inside the Wall object. The number of objects in front of it are not exact, and are determined by the wall's construction. You should use a loop to look for the Door, or possibly try ForEachObjectAtPoint(). There may be a more direct way to get to the Door-in-Wall that someone else can point to. I've just done a cursory quick dive at this. 

 

Again, make sure your handle is pointing to a Door object before trying to access its record.

 

HTH,

Raymond

Link to comment
3 hours ago, MullinRJ said:

Using: Message(GetTypeN(FSActLayer));

 

If I select a free standing Door I get type 86 (Plug-In object).

 

If I select a a Door in a Wall I get type 68 (Wall object).

 

To see the Door on a test wall I have in an open document, I needed to use:

Message(GetTypeN(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(NextObj(FIn3D(FSActLayer))))))))));

 

As you can see, the door object is deep inside the Wall object. The number of objects in front of it are not exact, and are determined by the wall's construction. You should use a loop to look for the Door, or possibly try ForEachObjectAtPoint(). There may be a more direct way to get to the Door-in-Wall that someone else can point to. I've just done a cursory quick dive at this. 

 

Again, make sure your handle is pointing to a Door object before trying to access its record.

 

HTH,

Raymond

 

Holy schniekies.  So, it looks like selecting a bunch of doors throughout a document and trying to change records in this way wouldn't work very well.  

 

What I was trying to do was create a script that would assign my default class scheme to doors that I pull in from older drawings.  

Link to comment

It actually is not that bad. There are a number of ways to do it with some fairly simple loops.

 

Probably the easiest would be a ForEachObject using a Criteria of Selected is True and PON = 'Door'. PON stands for Plug-in Object Name.

 

Code fragment not tested:

Procedure(Test);

Procedure Execute(Hd1:Handle);
Begin
  SetClass(Hd1,'MyClass');
End;

Begin
  ForEachObject(Execute, (((Sel=True) & (PON='Door'))));
End

Run(Test)

 

 

Link to comment
37 minutes ago, Pat Stanford said:

It actually is not that bad. There are a number of ways to do it with some fairly simple loops.

 

Probably the easiest would be a ForEachObject using a Criteria of Selected is True and PON = 'Door'. PON stands for Plug-in Object Name.

 

Code fragment not tested:


Procedure(Test);

Procedure Execute(Hd1:Handle);
Begin
  SetClass(Hd1,'MyClass');
End;

Begin
  ForEachObject(Execute, (((Sel=True) & (PON='Door'))));
End

Run(Test)

 

 

Thanks Pat!  I'll try this tomorrow and see how it goes.

Link to comment
16 hours ago, Pat Stanford said:

It actually is not that bad. There are a number of ways to do it with some fairly simple loops.

 

Probably the easiest would be a ForEachObject using a Criteria of Selected is True and PON = 'Door'. PON stands for Plug-in Object Name.

 

Code fragment not tested:


Procedure(Test);

Procedure Execute(Hd1:Handle);
Begin
  SetClass(Hd1,'MyClass');
End;

Begin
  ForEachObject(Execute, (((Sel=True) & (PON='Door'))));
End

Run(Test)

 

 

 

Holy crap, man...that worked!  This is going to make updating old files, and inserting new doors and windows, so much faster!

Link to comment

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.

×
×
  • Create New...