trying to creat 3dsolid using function

trying to creat 3dsolid using function

almutaz_86
Advocate Advocate
876 Views
2 Replies
Message 1 of 3

trying to creat 3dsolid using function

almutaz_86
Advocate
Advocate

Good Evening 
I'm trying to creat box from a function 
I don't know what I missed here :

Sub drawbox()
Call pvc(test, 18, 3, 250, 0, 0, 0)
End Sub

Public Function pvc(pvcname As String, Length As Double, Width As Double, Height As Double, center0 As Double, center1 As Double, center2 As Double)
Dim center(0 To 2) As Double
center(0) = center0: center(1) = center1: center(2) = center2
Set pvcname = ThisDrawing.ModelSpace.AddBox(center, Length, Width, Height)
End Function

 

0 Likes
Accepted solutions (2)
877 Views
2 Replies
Replies (2)
Message 2 of 3

Ed__Jobe
Mentor
Mentor
Accepted solution

You don't tell us what the problem is or what error you are getting. But I can see that your Call statement doesn't match the argument types. The way you have it, test is a variable name, not a string. Also, you do not use that argument in your function. It's unnecessary. Try:

Call pvc("test", 18, 3, 250, 0, 0, 0)

Or, eliminate the pvcname argument from your function.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 3

almutaz_86
Advocate
Advocate
Accepted solution

Thanks @Ed__Jobe 

there is a big mistake in that code:

 

public function pvc (pvcname As String,....)

 

pvcname should declared as acad3dsolid .

Or, eliminate the pvcname argument from your function.


and its worked after I removed it from funcion arguments

Half solution is a good solution 🙂

0 Likes