Thicken all surfaces inside block definition

Thicken all surfaces inside block definition

michal.nowakMPLWM
Participant Participant
734 Views
7 Replies
Message 1 of 8

Thicken all surfaces inside block definition

michal.nowakMPLWM
Participant
Participant

Hello
I want my lisp to modify all the surfaces in the block definition so that those blocks are thickened by fixed value 0.001
My current attemp is below

(defun c:test2 ( / s )
    (princ "\nSelect Block: ")
    (if (setq s (ssget "_+.:E:S" '((0 . "INSERT"))))
        (LM:ApplytoBlockObjects
            (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
            (vla-get-effectivename (vlax-ename->vla-object (ssname s 0)))
           '(lambda ( obj ) (command "_thicken" obj "0.01"))
        )
    )
    (princ)
)
(vl-load-com) (princ)
(defun LM:ApplytoBlockObjects ( blks name func / def result )
    (setq func (eval func))
    (if (not (vl-catch-all-error-p (setq def (vl-catch-all-apply 'vla-item (list blks name)))))
        (vlax-for obj def 
			(if (= (vlax-get-property obj 'ObjectName) "AcDbSurface")
				(setq result (cons (func obj) result))
			)
			(princ (vlax-get-property obj 'ObjectName))
		)
    )
    (reverse result)
)
0 Likes
735 Views
7 Replies
Replies (7)
Message 2 of 8

hosneyalaa
Advisor
Advisor

Can you attached example drawing 

0 Likes
Message 3 of 8

michal.nowakMPLWM
Participant
Participant

Sure @hosneyalaa ! please find the file attached.

The schema is following: I receive the exports from the external software of the objects, those are the blocks defined with 3D faces. I need those faces to be 3D solids as I want to export those to IFC4x3. Since the Civil 3D IFC export extension(Where to download IFC 4.3 Import/Export Extension for Civil 3D (autodesk.com) ignores 3D faces i need to thicken those.

 

I tried to define my lisp so that i choose the block reference and lisp loops through elements inside its definition and if those are 3d faces use the thicken on those. It can be any other approach that results with solids with fixed thickness.

As I mentioned before blocks are considered my input data so I cannot modify change the input type and I will need to modify significant number of blocks so I need to automate this process.
please find the file attached

0 Likes
Message 4 of 8

Sea-Haven
Mentor
Mentor

I exploded the block got 3dFaces I am not sure you can add a thickness. 

 

SeaHaven_0-1714174350399.png

 

0 Likes
Message 5 of 8

hosneyalaa
Advisor
Advisor

As mentioned @Sea-Haven 

You do not have AcDbSurface in your block
Visual LISP does not support creation AcDbSurface 

can you use dynamo  in civil 3d  to creation  3D solids

 

c1.JPG

0 Likes
Message 6 of 8

michal.nowakMPLWM
Participant
Participant

@Sea-Haven 

yes, you can. however there are two aspects why I am not going to do it this way:
1. My block(in a final scenario) have property sets attached and I want to keep it this way

2. There will be much more blocks like this so I want to keep those definiotns organized and apply the function to many objects

0 Likes
Message 7 of 8

michal.nowakMPLWM
Participant
Participant

@hosneyalaa thanks for the reply. I know I can use dynamo, i can do the coding in .NET as well. My idea was to do it with lisp due to the fact its easy to implement to other users. If there is no one that can help me with that I'll have to go with the workarounds.

 

Sorry for the confusion with AcDbSurface - I hoped it was clear with my description - i want to convert those 3d faces to the 3d solids, no matter if i named it correctly in my initial lisp attempt

0 Likes
Message 8 of 8

1157464091
Observer
Observer

Provide an idea : Firstly, obtain the 3D face entities in the block referenc ,then Use this function to thichening: vla-AddExtrudedSolid ,then use Leemac's function "addtoblock" to add the 3dsolids to blockreferenc  

0 Likes