Jump to content

Deleting 3d loci below a level (null data)

Recommended Posts

I am importing XYZ survey data and null data points are set to -9999. 

I need to delete these null data points (Loci with a Z value of -9999) I have managed to get this working for small areas of data using ForEachObject and checking the ZCoordinate  but it's too slow for big sections. Any other approaches that might be quicker?


nulv = int("-900")
def deletenulls(h):
	HeightValue = vs.ZCoordinate("T=LOCUS3D")
	if HeightValue < nulv:


Link to comment

ZCoordinate is returning the Z for every 3DLocus so you are actually doing the criteria search N+1 times.


Also, it is probably faster to do the delete once rather than in the loop.


The following will deselect everything in the drawing and then select jus the 3DLoci that are below the MyZ constant value. I will leave the conversion from Vectorscript to Python and adding the delete step to you.  Something like vs.deleteobjs


Procedure Test;

Const	MyZ=-2;

Procedure Execute(Hd1:Handle);

Var	X1,Y1,Z1:Real;
	If Z1 < MyZ then SetSelect(Hd1);

	ForEachObject(Execute, ((T=LOCUS3D)));



  • Like 1
Link to comment

Cheers Pat!

GetLocus3D is much better for what I want, I use the wiki to search for functions but it's easy to miss useful ones. 

As far as I can tell (and I may be wrong) with Python GetLocus3D returns a tuple rather than individual parameters so I have to extract Z value.

I could have used your Vectorscript but learning some Python is hopefully a by product of automating some things in vectorworks. 

The code below seems to work 


MyZ = -100
def Execute(h):
	TupXYZ = vs.GetLocus3D(h)
	pZ = TupXYZ[2]
	if pZ < MyZ:


  • Like 1
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.

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...