Anyone that can verify this lisp routine and if it works?

Anyone that can verify this lisp routine and if it works?

astofer
Participant Participant
686 Views
9 Replies
Message 1 of 10

Anyone that can verify this lisp routine and if it works?

astofer
Participant
Participant

I need to convert an exported Revit model into poly and 3d poly lines that I can put into a survey data collector and be able to layout in the field. I've tried another Lisp that didn't quite do what I needed and would like to try this one. I've put this into a text file saved it as ANSI and then renamed the file extension into .LSP. I've gotten it to load into Civil 3d 2024 but when I go to use it the command comes up but then doesn't do anything to the polyface meshes. Can someone please back check this? This is a 300 million dollar structure with over 2000 pages of drawings. It will take me the next year to fully model (I have a few weeks tops before I go on site) this out for use with a survey instrument. 

(defun c:XplPgMesh

(/ oApp oDoc oMSp oObj vXplObj aXplObj oObjLst oObj2 vCoords o3dPline)
(VL-LOAD-COM)
(setq oApp (vlax-get-acad-object)
oDoc (vla-get-activedocument oApp)
oMSp (vla-get-modelspace oDoc)
) ;setq
(vlax-for oObj oMsp
(if (= (vla-get-objectname oObj) "AcDbPolygonMesh")
(if (setq vXplObj (vla-explode oObj))
(progn
(setq aXplObj (vlax-variant-value vXplObj))
(if (not (minusp (vlax-safearray-get-u-bound aXplObj 1)))
(progn
(setq oObjLst (vlax-safearray->list aXplObj))
(foreach oObj2 oObjLst
(if (= (vla-get-objectname oObj2) "AcDbFace")
(progn
(setq vCoords (vla-get-coordinates oObj2)
o3dPline (vla-Add3DPoly oMSp vCoords)
) ;setq
(vlax-put-property o3dPline 'Closed :vlax-true)
(vla-delete oObj2)
(vlax-release-object o3dPline)
) ;progn
) ;if
) ;foreach
(foreach itm oObjLst (vlax-release-object itm))
) ;progn
) ;if
(vla-delete oObj)
) ;progn
) ;if
) ;if
) ;vlax-for
(princ)
)

0 Likes
687 Views
9 Replies
Replies (9)
Message 2 of 10

paullimapa
Mentor
Mentor

Perhaps you can include a sample dwg that you’re trying to run the lisp code on?


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 10

astofer
Participant
Participant

Here is a small part of it. 

0 Likes
Message 4 of 10

paullimapa
Mentor
Mentor

I can confirm that the lisp code does NOT convert polymesh


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 5 of 10

Sea-Haven
Mentor
Mentor

I have been supplying co-ord files for like 40 years from dwg. So I am trying to work out exactly what it is you want to set out. You talk about a polymesh, unfortunateky looking at this in Bricscad so no proxy objects. 

 

We provided full TIN's as 3dFaces for machine control, as that is what they used for bulk earthworks. Is that what your after ? Have you tried just explode the polymesh what does that reveal. It looks like you want structure locations say columns but with Z. 

 

Can you point to some objects you want to set out. 

 

A side note worked on a project, multiple roads, pathways bridges, ponds, viewing areas and wanted a 3d model something like 15 surface modifications. 

 

Just a side note the dwg is on a local datum we worked with GPS true world co-ordinates. 

 

If I get time will look again in CIV3D.

 

Found another dwg with poly face mesh just did a explode and got 3dfaces so could get all points into a list and remove duplicates. Hopefully not to many points as 30,000 is pretty easy to get to.

0 Likes
Message 6 of 10

diagodose2009
Collaborator
Collaborator

Your sample.dwg is wrong,  in my Acad.exe have bug the Sample.dwg, so I can not work at your Lisp.

--to execute automoto.lsp , you run Q2[enter].

Please before, you qSave the Sample.dwg , you save as old-version (acad2010, or acad2009), because the BrisCad2022, or ZwCad or AutoCad2014, cannot detect , or AutoCad2014 have bugs in Windows11.

I make other application.lisp(name automoto.lsp), all polygon are wrongs.

testprog.jpg

0 Likes
Message 7 of 10

hosneyalaa
Advisor
Advisor

@astofer 

If  you  have Revit file is better

What do you want to get from this? Image
You have a lot of separate elements

 

c1.JPG

 

7.gif

0 Likes
Message 8 of 10

astofer
Participant
Participant

Ill be doing some layout but mostly verification and running control for reality capture 3d scans of the structure and need the polymesh's broken down into simple poly and 3d polylines at the correct N,E,Z. I work in State Planes coordinates mostly or an arbitrary site datum if that's the absolute only way. On other models I've done this with when they are exported from Revit into C3d I'm able to explode them from regions into simple poly lines. For some reason however when this was modelled in Revit or some other program (may have been a double export from Tekla prior to Revit). This model goes from polyface mesh into 3d faces. Ill need the ablilty to layout or verify any and all of this structure. I wish I could share the whole thing as its a very cool building but it's under a NDA. I prefer using lines, polylines and 3d polys for most of my layout as my software will auto create most points anyways. This is also just a small sample of this structure and if I did points it would be close to million on a rough estimate. Trying to avoid having to trace this entire structure as all the slabs are multiple sweeping curves and not just a square building.

0 Likes
Message 9 of 10

astofer
Participant
Participant

I do have the Revit file thats how I got a 3d model into C3d2024 via export. However I need this all broken down into simple lines, polylines and 3d polys for use in a survey data collector.  See my other response for more details.  The Lisp I posted is supposed to break down polyface mesh's into points and then linework. If you or anyone else has a good lisp to achieve what im trying to do im more than happy to try it. 

0 Likes
Message 10 of 10

astofer
Participant
Participant

After plenty of frustration I did some monkeying around with the export settings from Revit and after a few tries was able to get a 3d model without polyface meshes. Thank you all for chiming in and trying to help out though. I can now go through and do what I need to do with this latest export. 

0 Likes