Jump to content

Jayme McColgan

Member
  • Posts

    196
  • Joined

  • Last visited

Posts posted by Jayme McColgan

  1. ok after a few hours of banging my head against the wall... PROGRESS. lol 

     

    I'm adding this to the init event:

    vs.DLDBeginLoadData(kDLDTypePointLoad)
    vs.DLDSetLoadDataString(kDLDSelectorGroupName, "Audio")
    vs.DLDSetLoadDataString(kDLDSelectorLoadName, "Speaker Array")
    vs.DLDEndLoadData()

     

    I added this during the AddState (44) event (I think that's the right one):

    vs.OLDShowTrussSnapping()

     

    and I'm adding this during the Reset event

    ### mass is 454 grams to 1 pound
    vs.OLDClearHangPtsPath(PIO_handle, 0) ### not sure if this is needed
    vs.OLDAddLoadHangPoint(PIO_handle, 0, 0,0,0, True) ### should this be a (0,0,0)?
    vs.OLDSetLoadDataBool(PIO_handle, kDLDSelectorInclude, True, 0)
    vs.OLDSetLoadDataReal(PIO_handle, kDLDSelectorWeight, vs.OLDMassStrToReal(f"{totalweight}lb")[1], 0)

     

    doing this seems to work pretty well. braceworks runs correctly (I think). I'm unable to connect a motor directly to my PIO. still working on that.

     

    all that being said this is only working on a single-point object... what's the workflow for adding weight to a distributed object? would it be vs.OLDAddLoadHangPoint() in a loop down the length of my object?

     

  2. hey! I'm slithering over from the Python forms as I'm having some trouble getting Truss Analysis to work correctly with my plugin and it seems no one in the python forms is doing much with it. there doesn't seem to be a lot of documentation on it... 

     

    I'm unsure when I should be init the various parts of it. I'm assuming that the things below need to be set up during the "kObjOnInitXProperties" event?

    vs.DLDBeginLoadData(kDLDTypeDestributedLoad)
    vs.DLDSetLoadDataString(kDLDSelectorGroupName, "Video")
    vs.DLDSetLoadDataString(kDLDSelectorLoadID, "LED Screen")
    vs.DLDSetLoadDataString(kDLDSelectorPrmWeight, "0 lb")
    vs.DLDSetLoadDataString(kDLDSelPrmTotalDistWght, "0 lb/ft")
    vs.DLDSetLoadDataReal(kDLDTypeDestributedLoad, vs.OLDMassDistStrToReal(f"{0} lb")[1])
    vs.DLDEndLoadData()

     

    and the code below needs to be set during the "kResetEventID" event? 

    test = vs.OLDMassDistStrToReal(f"{wallweight/wphy}lb/ft")[1]
    test2 = vs.OLDMassRealToStr(wallweight)[1]
    #vs.AlrtDialog(str(test))
    vs.OLDSetLoadDataReal(PIO_handle, 5, test, 0)
    vs.OLDSetLoadDataReal(PIO_handle, 8, test2, 0)
    vs.OLDSetLoadDataReal(PIO_handle, 9, test2, 0)

     

    things don't seem right after I do that. some guidance would be helpful. 

     

    also are there any endpoints outside the SDK for using the Equipment Subparts feature that some of the built-in VW tools use? 

  3. hey everyone,

     

    2 questions about dialog boxes...

     

    1. I vaguely remember seeing a symbol popup selector that opens a list of symbols and lets you pick one. am I crazy?

     

    2. I have an CreateEditText and a CreateStaticText to the right of it, there is some space between them, is it possible to get rid of that? 

     

    Screenshot2024-01-25at9_18_02AM.png.a0e55180a7fd8bc3f618ae13f5827e2c.png

  4. here's what I use to find out if I'm in top plan.

     

    topplan = vs.GetProjection(vs.ActLayer())
    
    if topplan != 6:
    	vs.SetView(xAngleR, yAngleR, zAngleR, offsetPt[0], offsetPt[1], offsetPt[2])
        
    #0 = Orthogonal
    #1 = Perspective
    #2 = Cavalier Oblique 45
    #3 = Cavalier Oblique 30
    #4 = Cabinet Oblique 45
    #5 = Cabinet Oblique 30
    #6 = Plan
    #7 = Section
    #8 = Section Plus

     

    • Like 1
  5. it looks like you are trying to make a curved LED wall... I was in a similar boat that no amount of math I did could get it perfect...

     

    the way I built mine is I inserted the tile then put in a loci at the location you want to curve to happen and store the handle of it and then on the next tile I repeat the process and moved the tile to the location of the previous loci I made and use the vs.RotatePoint() to rotate the desired amount. I also store all the loci in a list and delete them all after I'm done. 

     

    this is VERY disjointed but here's the basic premise... 

    vs.Symbol(fulltile, 0,0 , 0)
    vs.Locus3D(phywidth*curve_interval,0,0)
    last_loc = vs.LNewObj()
    
    ### other random code here ###
    
    curloc = vs.GetLocus3D(last_loc)
    vs.Move3DObj(last, curloc[0], curloc[1], 0)
    vs.RotatePoint(curloc[0], curloc[1], cur_angle)
    • Like 1
  6. yeah, sadly python can't run in the background... I would kill for some JS eventlistener style functionality that can run a script when stuff happens. maybe ill submit that as a feature request one day... 

     

    let me know if you end up diving into the SDK and how scary it is, I keep meaning to play around with it but I know NOTHING about C++. lol

  7. Here's how I get the items that are in a popup. i also use this flow to clear out popups and repopulate them with new values. 

     

    popupItems = []
    ok, parmid = vs.vsoPrmName2WidgetID('', 'Product')
    popupCnt = vs.vsoWidgetPopupGetCnt(parmid)
    for i in range(popupCnt):
      popupItems.append(vs.vsoWidgetPopupGet(parmid, i))
    
    vs.AlrtDialog(str(popupItems))

     

  8. yeah, this is gonna take a minute to figure out. I've moved the whole process to a 2 step which fixed my original issue. (I was probably gonna do that the whole time)

     

    BUT... now I'm back in the boat because I have a dialog to preview/edit the label and things like "vs.UpdateSymbolDisplayControl()" and such aren't working because I'm creating a temp symbol with a vs.CreateCustomObjectN() inside the temp symbol creating.

     

    I'll update if I achieve anything. 

  9. hello everyone. 

     

    I'm building a plugin that will allow me to export labels from a drawing to a pdf. I recently switched from just using symbols and linked text fields to a small point object plugin which gives me more flexibility with text and such.

     

    when I export the pdf using the code below none of the point object plugins show up in the exported file BUT if I navigate to the sheet layer that the code made they are there. this workflow worked fine when using just symbols. 

     

    my initial thought is that since it is spawning the PIO within the same script that's exporting the PDF maybe they don't visually exist yet?

     

    Here's the code. I stripped out some other code so it might look weird... 

     

    if vs.AcquireExportPDFSettingsAndLocation(True):
      vs.OpenPDFDocument(f"{filename}")
      width = 8.5*vs.GetUnits()[3]
      height = 11*vs.GetUnits()[3]
      sheet_num = f"PL-{num}"
      name = f"Printable Labels - {num}"
    
      curlayer = vs.CreateLayer(sheet_num, 2) ### Create Sheet Layer
      vs.SetObjectVariableString(curlayer, 159, name) ### Set Sheet Layer Name
      vs.SetDrawingRect(width, height) ### Set Sheet Layer Size
        
      last = vs.CreateCustomObjectN('Fixture Label Object',x,y,0, False)
      vs.SetRField(last,'Fixture Label Object','symbolname', final_label)
        
      vs.ExportPDFPages(f"PL-{i+1}")
      vs.ClosePDFDocument()
        

     

  10. sadly it's not feasible to ask the users I'm building these plugins for to do that... 

     

    for now, I've started a new file for symbols that my plugins would be pulling in and left all the other random symbols in the other file. I don't think it's the final fix but it's a good bandaid so I can get users up and running on VW24.

     

    at this point, I'm more curious about what changed from VW22 to VW24 that is causing this. I try to reserve contacting the VW devs but I'm starting to get to that point. lol

     

    but to your original question @MullinRJ yes if I have the remote file open it's wicked fast. so it obviously has something to do with opening the file. 

  11.  

    2 hours ago, MullinRJ said:

    did you convert your reference file to VW 2024 format

    yes it was converted for VW2024

     

    2 hours ago, MullinRJ said:

    then I would find a way to partition your non-partitionable file into two or more smaller files

    this is what I'm trying to avoid but it might come to this. 

     

    2 hours ago, MullinRJ said:

    Try copying the file to your computer and try again. Does it run faster when the file is local?

    This file is local. it lives in the user favorites folder. 

     

    copying some of the symbols to a smaller file fixes it so I'm assuming that's the issue. 

     

    i talked with some of the devs at VW last week while I was there and i was told that vs.CopySymbol() now has to open the file to copy things but building a resource list should be must faster. it doesn't seem to be the case... 

  12. so I'm coming from VW22 and updating my plugins for VW24... part of the script imports some symbols from an external .vwx file (the file is almost 1GB in size). when I run the plugin in VW24 both vs.BuildResourceListN2() and vs.CopySymbol() takes several seconds vs VW22 did it instantly. 

     

    here's the code I've tried to use:

     

    vs.CopySymbol(os.path.join(vs.GetFolderPath(23) , symbol_file), cursym)

     

    fixute_file = os.path.join(vs.GetFolderPath(23) , cable_file)
    symbolslist, nums = vs.BuildResourceListN2(16, fixute_file, False)
    
    for i in range(nums):
      name = vs.GetNameFromResourceList(symbolslist, i+1)
      if name == cursym:
        vs.ImportResToCurFileN(symbolslist, i+1, importcall)

     

    I'm not really sure what else to try at this point to speed up the process. I also won't be able to make the external file any smaller. it's filled with symbols we use all the time. 

  13. Here's the Python Version of this for future people. I added some error checking to make sure that symbol name doesn't already exist.

     

    Pcontinue = True
    
    ### get symbols in current cad
    cur_symbols = []
    MyList, NumItems = vs.BuildResourceList(16, 0, '')
    for i in range(NumItems):
      MyName = vs.GetNameFromResourceList(MyList, i+1)
      cur_symbols.append(MyName)
    
    ### Pull Case Name
    case_name = str(vs.GetRField(PIO_handle, recname, "Case Name"))
    
    ### If not case Name define one
    if not case_name:
      case_name = vs.StrDialog('Enter Case name','')
      if vs.DidCancel() or not case_name:
        Pcontinue = False
    
    if Pcontinue:
      ### Check for unique name
      test = 1
      main_name = case_name
      while case_name in cur_symbols:
        case_name = f"{main_name}-{test}"
        test += 1
        
      x,y = vs.GetSymLoc(PIO_handle)
    
      vs.BeginSym(case_name)
      vs.Locus(0,0)
      tempHd =vs.LNewObj()
      vs.EndSym()
    
      h = vs.CreateDuplicateObject(PIO_handle,vs.GetObject(case_name))
      vs.HMove(h,-x,-y)
      vs.DelObject(tempHd)
      vs.SetObjectVariableBoolean(vs.GetObject(case_name),127,True)

     

  14. On 9/25/2023 at 11:25 AM, Pat Stanford said:

    I don't think there is a way to do what you want.

     

    You could make the object Event Enabled and then put a button in the OIP that calls a dialog box to do your setup. But I don't think there is a way to have a "tool palette" that shows when an object is selected or created.  Maybe with the SDK.

     

    I have created scripts that checked for a modifier key when they start and do different things (in my case opened a preferences dialog box) if the Option key is held down when the script it run.  Would something like that work for you?

    yeah, I basically just need to make a tool pallet of buttons and text fields that trigger a script. i didn't think there was a way to do that, thought id ask though. 

  15. @michaelk you can't do vs.RectangleN(-12",-12",0.03,0,24",24") in python... I would have to convert all those values to a string first and that defeats the purpose of all this... lol

     

    @MullinRJ that seems like a good quick fix. Is there any downside to doing this?

     

    @JBenghiat i ended up going that route lat night after posting this. converting everything to a variable and using vs.ValidNumStr(f'{-6.2}"')[1]. in another plugin I used 8.5*vs.GetUnits()[3]. they both seem to work fine.

     

×
×
  • Create New...