Jump to content

Sloader

Member
  • Posts

    37
  • Joined

  • Last visited

Reputation

6 Neutral

Personal Information

  • Location
    United Kingdom

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Is the issue that the error isn't a python error but a VW message so the try code always gets executed? I think vs.ResetObject(h) will be usefull
  2. My scripts (one to create the massing models and one to set the roofs to pitched) were working but now, presumably due to a service pack change, the pitched roof one no longer results in pitched roofs. As below the roofs are set to be pitched but not drawn pitched, If I paste the massing models into a new drawing VW tries to draw pitched roofs but fails on some and I get the repeating error messages - but now there are more messages so its even more irritating. def trypitched(h):#try making pitched roofs try: vs.SetRField(h,'Massing Model','DrawPitchedRoof',True) except: pass vs.ForEachObject(trypitched, "((PON='Massing Model'))" ) #loop for all the massing models DEMO.vwx
  3. ""((SEL=True))" Doesn't work "((SEL=True))" Does work "((L='XX-ZZ-P-G-OS_MasterMap Fills-3D-2'))" Does work ((L='XX-ZZ-P-G-OS_MasterMap Fills-3D-2')) From the criteria builder doesn't work (language is set to python) - I write the criteria by hand as the builder has never worked and was one of the issues that really slowed me down when first trying to write scripts. If I wrap it in double quotes it does work "((L='XX-ZZ-P-G-OS_MasterMap Fills-3D-2'))" I can see why my original criteria didn't work, though I was following a previous example that did work - "T=LOCUS"
  4. The send to surface command fails when I run it with a large number of polygons so I was hoping to loop though all my polygons using a script. The script below is my attempt but it doesn't make anything happen. dtmL=vs.GetObject('XX-ZZ-M-U-LiDAR_DTM') hdtm=vs.DTM6_GetDTMObject(dtmL,True) def SendSurface(h): vs.DTM6_SendToSurface(hdtm, h, 0) vs.ForEachObject(SendSurface, "L=XX-ZZ-P-G-OS_MasterMap Fills-3D-2" )
  5. It makes little sense to me that the python escape character is /n yet a path with /n works fine whilst a path with /N doesn't. Also I am not sure why it used to work fine on MAC but when transferring my scripts to PC it wouldn't run. Is there a reliable way to include a file path that won't get escaped by python due to any of the special characters ?
  6. Adding and extra "\" does make the compiler happy but I have already changed the name to "nnr" which works fine, both options seem unnecessary. I was interested if my script is incorrect - I assumed the contents between ' ' would be interpreted as a string LNR = vs.ImportDXFDWGFile('C:\DOCs\SCRIPT\\NNR.dxf', isBatch)
  7. This line (on its own as a test but also as part of a bigger script) compiles fine LNR = vs.ImportDXFDWGFile('C:\DOCs\SCRIPT\LNR.dxf', isBatch) But if I change the file to NNR.dxf (national and local nature reserves) the script doesn't compile and I get a error as below which makes no sense to me as all I change is an L to an N NNR = vs.ImportDXFDWGFile('C:\DOCs\SCRIPT\NNR.dxf', isBatch) it even works with lower case NNR NNR = vs.ImportDXFDWGFile('C:\DOCs\SCRIPT\nnr.dxf', isBatch)
  8. I am working with a schedule of development parcels. I have database rows that add up some calculations based on (summarized by) parcel numbers in a database record, each parcel is made up of sections with different densities, the densities are specified in the database record. Summing up for the area works fine and calculating the total units works fine as its the sum of area*density for each section of the parcel. The issue I am having is in trying to calculate the resulting density for each parcel. If I sum up units/density I obviously get numbers that make no sense, if I have 2 sections of a parcel at a density of 30 the overall density isn't 60. Essentially I want perform calculations on the summed values in the other rows not make calculations for each part then add them up.
  9. We often receive base-mapping as DWGs, one of the supply options has layer names that do not translate into class names correctly. Names like "Road Or Track_Structure , Manmade , Bridge" get translated to something like "$TD_AUDIT_GENERATED_(A9)" which isn't very helpful. AutoCAD and QGIS interpret the names correctly and if I re-export from QGIS as a DXF with the commas replaced the names are interpreted ok.
  10. @DomC The "Try Except" approach works nicely so I have managed to get VW to do what I want and learnt something new in Python. I am still using the "Pitched" attribute from GIS so I can prevent buildings above or below a certain size from having pitched roofs but I should now be able to relax the restriction on how complex a roof I let it try and make pitched. try: vs.SetRField(h2,'Massing Model','DrawPitchedRoof',Pitched) except: pass
  11. The try / except approach looks ideal - When I get time I'll try setting the roof to pitched (True) and false if it fails The something heavy on the key option was explored E7 S7 of the Simpsons which clearly demonstrates some of the drawbacks of this approach
  12. Script below is cleaned up a bit. It now works with heights from my records and I have got GIS to do some guessing about which lines are too complex for a pitched roof in addition to cleaning up angles near 0 or 90. There will still be many polylines that are too complex so it would be good to suppress the failure messages so I don't have to sit and hold the return key whilst it runs, this would also mean I can relax the inputs on which polylines it tries to add a pitched roof to. storeyht=3 vs.SelectObj("T=GROUP") vs.Ungroup() def gone(h1): vs.ConvertToPolygon(h1, 0) vs.ForEachObject(gone, "T=POLYLINE" ) #loop for all the polylines and convert them to polygons def extrudebuildings(h):#make massing model buidlings based on records RecName=vs.GetName(vs.GetRecord(h,1)) Pitched=vs.GetRField(h, RecName,'PITCHED')#Get pitched boolean from record AOD=vs.GetRField(h, RecName,'TM_mean')#Get AOD height from record TM=eval(vs.GetRField(h, RecName,'TM_mean'))#convert AOD height to number SM=eval(vs.GetRField(h, RecName,'SM_max'))#Get max surface height as number BHT=SM-TM Storeys = ((SM-TM)-2)/storeyht Floors = vs.Round(Storeys) vs.CreateCustomObjectPath('Massing Model', h, None) h2 = vs.LNewObj() # get handle to new massing model vs.SetRField(h2,'Massing Model','2Ddisplay','Roof') vs.SetRField(h2,'Massing Model','Height',BHT) vs.SetRField(h2,'Massing Model','NumFloors',Floors) vs.SetRField(h2,'Massing Model','WallMatl','') vs.SetRField(h2,'Massing Model','Custom Roof','False') vs.SetRField(h2,'Massing Model','Overhang','0.3') vs.SetRField(h2,'Massing Model','RoofThk','0.3') vs.SetRField(h2,'Massing Model','RoofMatl','') vs.SetRField(h2,'Massing Model','DrawPitchedRoof',Pitched) vs.SetRField(h2,'Massing Model','EaveStyle','Square') vs.SetRField(h2,'Massing Model','RoofPitch','35') vs.SetRField(h2,'Massing Model','DrawFloorLevels','True') vs.SetRField(h2,'Massing Model','FloorThk','0.3') vs.SetRField(h2,'Massing Model','Use Site Modifiers','False') vs.SetRField(h2,'Massing Model','Use Fence','True') vs.SetRField(h2,'Massing Model','Fence offset','0.02') vs.SetRField(h2,'Massing Model','Use Shadow','False') vs.Move3DObj(h2, 0, 0, AOD) vs.ForEachObject(extrudebuildings, "T=POLY" ) #loop for all the polygons
  13. I am trying to create a site model that has a hole in it. The single crop object does have a hole but the resulting donut is more of a cake. Can it be done without cutting a thin slice out of the donut?
  14. When creating massing models some don't work because of the line geometry, this is fine but can I let VW ignore the issues without me holding down the return key?
  15. I found my error but can't see how to delete this topic My eventual goal is to build a set of massing models based on polygons with records for height etc. I can't see anything in the help files for the massing model custom object so what I have so far is based on exporting a script from a file with massing models in it. It looks like I should be able to change the fields for number of floors and height etc based on the records once I have got it to build massing models. So far what I have runs and creates massing models but they don't show on screen or export, I can select them and see their properties but there is clearly something very wrong with them. vs.SelectObj("T=GROUP") vs.Ungroup() def gone(h1): vs.ConvertToPolygon(h1, 0) vs.ForEachObject(gone, "T=POLYLINE" ) #loop for all the polylines and convert them to polygons def extrudebuildings(h):#Extrude buidlings based on records vs.CreateCustomObjectPath('Massing Model', h, none) h2 = vs.LNewObj() # get handle to new symbol instance vs.Record(vs.LNewObj(),'Massing Model'); vs.SetRField(vs.LNewObj(),'Massing Model','2Ddisplay','Roof'); vs.SetRField(vs.LNewObj(),'Massing Model','Height','6.096'); vs.SetRField(vs.LNewObj(),'Massing Model','NumFloors','2'); vs.SetRField(vs.LNewObj(),'Massing Model','WallMatl',''); vs.SetRField(vs.LNewObj(),'Massing Model','Custom Roof','False'); vs.SetRField(vs.LNewObj(),'Massing Model','Overhang','0.3048'); vs.SetRField(vs.LNewObj(),'Massing Model','RoofThk','0.3048'); vs.SetRField(vs.LNewObj(),'Massing Model','RoofMatl',''); vs.SetRField(vs.LNewObj(),'Massing Model','DrawPitchedRoof','False'); vs.SetRField(vs.LNewObj(),'Massing Model','EaveStyle','Square'); vs.SetRField(vs.LNewObj(),'Massing Model','RoofPitch','35'); vs.SetRField(vs.LNewObj(),'Massing Model','DrawFloorLevels','True'); vs.SetRField(vs.LNewObj(),'Massing Model','FloorThk','0.3048'); vs.SetRField(vs.LNewObj(),'Massing Model','Use Site Modifiers','False'); vs.SetRField(vs.LNewObj(),'Massing Model','Use Fence','True'); vs.SetRField(vs.LNewObj(),'Massing Model','Fence offset','0.0254'); vs.SetRField(vs.LNewObj(),'Massing Model','Use Shadow','False'); vs.ForEachObject(extrudebuildings, "T=POLY" ) #loop for all the polygons
×
×
  • Create New...