Jump to content

twk

Member
  • Posts

    877
  • Joined

  • Last visited

Posts posted by twk

  1. 28 minutes ago, JBenghiat said:

    I'm unclear whether you are using the worksheet to process data or whether the worksheet is the end goal. If the former and you're creating the script for your own use, you can just use ForEachObject() with the criteria you are using for the worksheet report, and GetRField() to retrieve any data without dealing with the worksheet. 

     

    The aim is to have the worksheet as a sort of staging area for the filtering and sorting of windows/doors. -- (I'm creating an automatic window/door elevation tool for schematic scheduling)

     

    Once the filtering was set I found there was no way for me to sift through the displayed subrow data and grab the object handles to create the elevation on the drawing. Now I can!

     

    I did use the ForEachObject() on the db criteria, however any sorting that happened on the worksheet was difficult to replicate through my script. I'd rather have the sorting/grouping all done on the worksheet, and then have the graphical display just pull from the UUID on the worksheet.

     

  2. 3 hours ago, JBenghiat said:

    A few versions ago, Vectorworks started adding a UUID to every object. This doesn’t seem to be on the developer wiki, but GetObjectByUuid() and GetObjectUuid() are valid calls. As this ID is core level, it will be a lot more robust than a plug-in code managed ID. 

     

    This will actually do it. Thanks a million guys. How do you find these @JBenghiat!

    On that note, would you know if there is a function call for this for worksheets? I've resorted to creating a script to pull that info into the worksheet, and can then cylce through the worksheet to grab the UUID and the object on the drawing.

     

    Would be perfect if I could skip the script part, as everytime the worksheet resets it asks me to execute the script.

     

    In any case, thanks again.

     

     

  3. Greetings all,

    I have a worksheet that shows all windows/doors in the drawing. 

    I was trying to grab handles to these objects from the worksheet database, but could not find any sdk functions to call it.

     

    So I added an extra column that calls the GlobalID from the IFCDoor/IFCWindow, and noticed that these are as expected all unique ids.

     

    My question is, does this ID, remain throughout the life of the drawing document? as opposed to handles? Could I then use these ID's to uniquely identify these in a script database somehow?

     

    Cheers,

    Tui

     

     

     

  4. We class our Site Model (Site-DTM-Main), then toggle that to grey when we need to manipulate other objects on the same layer as the site model. You are true that it is a pain that the Site Model takes precedence over any other object.

  5. Confirming this happens to me as well.

    A workaround is to apply a roof style to the created roof.  

     

    vs.BeginRoof(roofAxisPoint0[0], roofAxisPoint0[1], roofAxisPoint1[0], roofAxisPoint1[1], upslopePoint[0], upslopePoint[1], rise, run, 1, 0)
    vs.Rect(rectTopLeft[0], rectTopLeft[1], rectBottomRight[0], rectBottomRight[1])
    vs.EndGroup()
    
    roofFace = vs.LNewObj()
    vs.SetObjectVariableReal(roofFace, 170, roofFaceThickness)
    # vs.SetFPat(roofFace, 1)
    
    style='' # import/create a roof style and add to this variable
    vs.SetRoofStyle(roofFace, vs.Name2Index(style))
    vs.ResetObject(roofFace)

     

  6. Just moving into 2019 now, and transferring one of our larger projects to take advantage of the new features. Having testing 2019 through SPs 1-4 and now on 5.2 with smaller projects, we are confident to take the dive.

     

    First off, the data tag has been such a breath of fresh air, in terms of a common-sense tool release, so thanks again to the devs at VW.

     

    Secondly, a couple of questions for other users who have being using 2019 in the wild since its release and the data tag tool.

    a) Is it possible to un-link an existing data tag thats been placed in the annotations viewport, to another object? e.g, A tower type building, you tag all the windows on level 1, in the annotations space, you then duplicate the whole layer (to do the next story up), you change the layer visibilities for the viewport to have the design layers for the next level up. Then realise the data tags from the previous level are still in the annotations space for this new level, however theyre still linked to the windows from the level below. Would be great to relink these tags to the new level. I havent found a way yet, if others know of way that would be great.

    b) Is it possible to have the data tag look into design layer viewports on a design layer, while your in the annotation space of the sheet layer? Again, I couldn't see a way, wondering if anyone else knows.

     

    If neither are possible, I will file an enhancement request.

     

    Cheers,

    Tui

     

     

  7. There isn't much script functionality on the DevWiki regarding Data Tags.

     

    I was wondering if anyone knew how to get a handle to an object a data tag is attached to.

     

    Say I can collect all the data tags in a viewport, as handles, does anyone know how to get handles to objects those data tags are attached to?

     

    Cheers,

    Tui

     

     

  8. Havent tested, but you could use the WallFootPrint(WallHandle) function to create a dummy polygon of the outline of the curved wall. And check if that polygon is within LOC, then delete this dummy polygon.

     

    May create memory overhead with creating and deleting objects. Again, havent tested.

  9. Swapped out the HScale2D for HScale3D, and seems to scaling fine here. Working on Extrudes though. What particular 3D objects where you trying to scale?

    # DISCLAIMER
    # - Python Novice
    #  - Script presented as is
    #  - save your work before using
    # - use at your own risk
    # - no responsibilty taken for damage to your property from the use of this script
    # - copyright twk 2016
    # - forum link = https://forum.vectorworks.net/index.php?/topic/19675-how-can-i-scale-multiple-objects-from-each-objects-center/
    # - Tested on Windows 10 x64, Vectorworks 2016 SP4
    
    def List_SelectedObjs_in_Layer(): # small function to store all selected objects on the current layer into a usable list (python list)
    	h_FirstInContainer = vs.FIn3D(vs.ActLayer())
    	listObjs_inContainer = []
    	while (h_FirstInContainer != None):
    		if vs.Selected(h_FirstInContainer):
    			listObjs_inContainer.append(h_FirstInContainer)
    		h_FirstInContainer = vs.NextObj(h_FirstInContainer)
    
    	return listObjs_inContainer
    
    list_selObjs = List_SelectedObjs_in_Layer() # function called, selected objects stored
    countIt = len(list_selObjs) # number of selected objs store in countIt variable
    
    if countIt > 0: # checking to make sure at least 1 or more objects are selected
    	scaleAmount = vs.RealDialog("Enter Scale Amount", "1.5")
    	if not vs.DidCancel(): # checking to make sure predefined Dialog's OK button was pressed
    		for eachObj in list_selObjs:
    			center = vs.HCenter(eachObj) # getting center of obj to be used in next function
    			# vs.HScale2D(eachObj,center[0],center[1],scaleAmount, scaleAmount, True)
    			vs.HScale3D(eachObj, center[0], center[1], 0, scaleAmount, scaleAmount, scaleAmount)
    		vs.ReDrawAll() # redraw-ing the screen as is needed after running HScale2D
    		vs.AlrtDialog("{} Objs scaled".format(countIt)) #indicates the number of objects scaled
    else:
    	vs.AlrtDialog("At least 1 object must be selected") # checking to make sure at least 1 or more objects are selected

     

    • Like 1
×
×
  • Create New...