sweep with VBA
sweep with VBA
06-06-2011 11:40 . am | View his/her posts only
Hi all.
Is it possible to make one sweep with VBA? I need to sweep one 3D polyline with one circle as section.
Thanks.
Sergio.
08-06-2011 04:23 . am | View his/her posts only
Hi sergioc,
Sorry that in ZWCAD VBA do not support Sweep command.
Sorry that in ZWCAD VBA do not support Sweep command.
sweep with VBA
09-06-2011 03:29 . am | View his/her posts only
Hi sergioc,
Sorry that in ZWCAD VBA do not support Sweep command.
tnx Daniel ,
as per your experience, is it possible to proceed as follows??...:
-create a circle setting the right diameter
-create a region from it
-move it to the end (or beginning ) of the 3Dpoly),checking its perpendicularity to the 3Dpoly (!)
-extrude the region along the 3Dpoly...
I can quite assume that the 3Dpoly runs only on X,Y and Z axes parallel rects, switching with 90?elbow.
I searched for something similar on the net and seems that the best way is to extrude the region and ,if this fails,to rotate the region and try again until it works.
Have you ever worked on a similar deal?
Have you got any reference or shall I start for scratch?
Sergio
PS:
...talking about databases... (as mySQL) and NET (as MS VB.NET):
If I 've rightly understood,you warned that those architectures won't work with ZWCAD, that isn't correct because they work on my pc...
...Hope to hear from you soon...
Sorry that in ZWCAD VBA do not support Sweep command.
tnx Daniel ,
as per your experience, is it possible to proceed as follows??...:
-create a circle setting the right diameter
-create a region from it
-move it to the end (or beginning ) of the 3Dpoly),checking its perpendicularity to the 3Dpoly (!)
-extrude the region along the 3Dpoly...
I can quite assume that the 3Dpoly runs only on X,Y and Z axes parallel rects, switching with 90?elbow.
I searched for something similar on the net and seems that the best way is to extrude the region and ,if this fails,to rotate the region and try again until it works.
Have you ever worked on a similar deal?
Have you got any reference or shall I start for scratch?
Sergio
PS:
...talking about databases... (as mySQL) and NET (as MS VB.NET):
If I 've rightly understood,you warned that those architectures won't work with ZWCAD, that isn't correct because they work on my pc...
...Hope to hear from you soon...
08-06-2011 04:23 . am | View his/her posts only
Hi sergioc,
First I have to say, I am not an expert on programming.
But as I know, you can try this function in VBA: object.AddExtrudedSolidAlongPath
Actually in ZWCAD, you can go to Menu Help -> Developer Help to check the detail of this function (Also when any time you need to check something about API), there is an example inside for your reference:
Sub Example_AddExtrudedSolidAlongPath()
' This example extrudes a solid from a region
' along a path defined by a line
' The region is created from a circle
Dim curves(0 To 0) As ZwcadEntity
' Define the circle
Dim centerPoint(0 To 2) As Double
Dim radius As Double
centerPoint(0) = 1#: centerPoint(1) = 1#: centerPoint(2) = 0#
radius = 10#
Set curves(0) = ThisDocument.ModelSpace.AddCircle(centerPoint, radius)
' Create the region
Dim regionObj As Variant
regionObj = ThisDocument.ModelSpace.AddRegion(curves)
' Define the extrusion path
Dim startpnt(0 To 2) As Double
Dim endpnt(0 To 2) As Double
startpnt(0) = 10: startpnt(1) = 10: startpnt(2) = 5
endpnt(0) = 10: endpnt(1) = 10: endpnt(2) = 0
Dim lineObj As ZwcadLine
Set lineObj = ThisDocument.ModelSpace.AddLine(startpnt, endpnt)
Dim solidObj As Zwcad3DSolid
Set solidObj = ThisDocument.ModelSpace.AddExtrudedSolidAlongPath(regionObj(0), lineObj)
ThisDocument.Regen
ThisDocument.ActiveViewport.ZoomAll
End Sub
--------------
I hope this may help you.
PS: about the database issue, yes, I was wrong. mySQL as a third party environment, it can interact with ZWCAD normally.
For .Net, I need to clarify that ZWCAD do not support .Net API. I am not sure how you work with .Net with ZWCAD, but as I know, as a kind of development environment, .Net do can operate ZWCAD by using the COM interface in ZWCAD. so it means operate ZWCAD in .Net by COM, not using .Net in ZWCAD.
First I have to say, I am not an expert on programming.
But as I know, you can try this function in VBA: object.AddExtrudedSolidAlongPath
Actually in ZWCAD, you can go to Menu Help -> Developer Help to check the detail of this function (Also when any time you need to check something about API), there is an example inside for your reference:
Sub Example_AddExtrudedSolidAlongPath()
' This example extrudes a solid from a region
' along a path defined by a line
' The region is created from a circle
Dim curves(0 To 0) As ZwcadEntity
' Define the circle
Dim centerPoint(0 To 2) As Double
Dim radius As Double
centerPoint(0) = 1#: centerPoint(1) = 1#: centerPoint(2) = 0#
radius = 10#
Set curves(0) = ThisDocument.ModelSpace.AddCircle(centerPoint, radius)
' Create the region
Dim regionObj As Variant
regionObj = ThisDocument.ModelSpace.AddRegion(curves)
' Define the extrusion path
Dim startpnt(0 To 2) As Double
Dim endpnt(0 To 2) As Double
startpnt(0) = 10: startpnt(1) = 10: startpnt(2) = 5
endpnt(0) = 10: endpnt(1) = 10: endpnt(2) = 0
Dim lineObj As ZwcadLine
Set lineObj = ThisDocument.ModelSpace.AddLine(startpnt, endpnt)
Dim solidObj As Zwcad3DSolid
Set solidObj = ThisDocument.ModelSpace.AddExtrudedSolidAlongPath(regionObj(0), lineObj)
ThisDocument.Regen
ThisDocument.ActiveViewport.ZoomAll
End Sub
--------------
I hope this may help you.
PS: about the database issue, yes, I was wrong. mySQL as a third party environment, it can interact with ZWCAD normally.
For .Net, I need to clarify that ZWCAD do not support .Net API. I am not sure how you work with .Net with ZWCAD, but as I know, as a kind of development environment, .Net do can operate ZWCAD by using the COM interface in ZWCAD. so it means operate ZWCAD in .Net by COM, not using .Net in ZWCAD.
sweep with VBA
10-06-2011 08:44 . am | View his/her posts only
Daniel thanks for your help.
I'm getting closer to the solution with your support but now I've another issue...
When I use the following code for to make a new UCS (I need it for to have one region perpendicular to the origin of my line ,for the extrusion) ZWcad still draw in the old one.
I'm confident with the rule that I can draw only on X-Y plane ,with this code the circle is made on Z-X plane.
Please check.
Thanks again.
Sergio
----------
Public Sub new_UCS()
Dim StartPoint(0 To 2) As Double
Dim xAxisPnt(0 To 2) As Double
Dim yAxisPnt(0 To 2) As Double
StartPoint(0) = 0: StartPoint(1) = 0: StartPoint(2) = 0 'origin is shared
' I use this way for to rotate the UCS ,maybe there is another better...
xAxisPnt(0) = StartPoint(0) + 1: xAxisPnt(1) = StartPoint(1): xAxisPnt(2) = StartPoint(2)
yAxisPnt(0) = StartPoint(0): yAxisPnt(1) = StartPoint(1): yAxisPnt(2) = StartPoint(2) + 1
'this routine erase previous ucs
For Each ucsObj In ThisDocument.UserCoordinateSystems
ucsObj.Delete
Next
Set ucsObj = ThisDocument.UserCoordinateSystems.Add(StartPoint, xAxisPnt, yAxisPnt, "TestUCS")
ThisDocument.ActiveUCS = ucsObj
'now on ZWCAD the axes rotate
Dim curves(0 To 0) As ZwcadEntity
Set curves(0) = ThisDocument.ModelSpace.AddCircle(StartPoint, "10")
curves(0).Update
End Sub
------
I'm getting closer to the solution with your support but now I've another issue...
When I use the following code for to make a new UCS (I need it for to have one region perpendicular to the origin of my line ,for the extrusion) ZWcad still draw in the old one.
I'm confident with the rule that I can draw only on X-Y plane ,with this code the circle is made on Z-X plane.
Please check.
Thanks again.
Sergio
----------
Public Sub new_UCS()
Dim StartPoint(0 To 2) As Double
Dim xAxisPnt(0 To 2) As Double
Dim yAxisPnt(0 To 2) As Double
StartPoint(0) = 0: StartPoint(1) = 0: StartPoint(2) = 0 'origin is shared
' I use this way for to rotate the UCS ,maybe there is another better...
xAxisPnt(0) = StartPoint(0) + 1: xAxisPnt(1) = StartPoint(1): xAxisPnt(2) = StartPoint(2)
yAxisPnt(0) = StartPoint(0): yAxisPnt(1) = StartPoint(1): yAxisPnt(2) = StartPoint(2) + 1
'this routine erase previous ucs
For Each ucsObj In ThisDocument.UserCoordinateSystems
ucsObj.Delete
Next
Set ucsObj = ThisDocument.UserCoordinateSystems.Add(StartPoint, xAxisPnt, yAxisPnt, "TestUCS")
ThisDocument.ActiveUCS = ucsObj
'now on ZWCAD the axes rotate
Dim curves(0 To 0) As ZwcadEntity
Set curves(0) = ThisDocument.ModelSpace.AddCircle(StartPoint, "10")
curves(0).Update
End Sub
------
08-06-2011 04:23 . am | View his/her posts only
Hi sergioc,
Thanks for the code, we have confirmed that it is a but in ZWCAD, that it fails to change the ucs in VBA. We have forwarded problem to the develop team, once there is a fix we will inform you here.
sweep with VBA
20-06-2011 02:06 . am | View his/her posts only
Ok.
I really need this.Please could you add some explanation for how to correctly change througth the X-Y-Z ?
The goal remain the same: to draw one region perpendicular at the beginning of a one line and to make the " extrude with path" function for to generate the solid, as per previous post.
If also "sweep" function will be provided ,this will be great.
Thanks a lot.
I really need this.Please could you add some explanation for how to correctly change througth the X-Y-Z ?
The goal remain the same: to draw one region perpendicular at the beginning of a one line and to make the " extrude with path" function for to generate the solid, as per previous post.
If also "sweep" function will be provided ,this will be great.
Thanks a lot.
sweep with VBA
23-08-2011 03:14 . am | View his/her posts only
Hi sergioc,
Thanks for the code, we have confirmed that it is a but in ZWCAD, that it fails to change the ucs in VBA. We have forwarded problem to the develop team, once there is a fix we will inform you here.
I'm still waiting for this fix .
Thanks
sweep with VBA
02-10-2011 04:24 . am | View his/her posts only
Calls the system function DllUnRegisterServer to unregister modules passed in on the command line. Specify the full path to the DLL. For example, for MY_FILE.DLL in the current folder you can use:
msiexec /z .'MY_FILE.DLL
This option is only used for registry information that cannot be removed using the registry tables of the .msi file.
website design flash
pubblicit?su internet
msiexec /z .'MY_FILE.DLL
This option is only used for registry information that cannot be removed using the registry tables of the .msi file.
website design flash
pubblicit?su internet
sweep with VBA
18-11-2011 07:09 . am | View his/her posts only
it is not a ZW bug.
Through the VBA ZW always draws on world ucs.
For to change the position the translate coordinate method is needed.for to change the x,y,z vector the translate with matrix is needed.
Through the VBA ZW always draws on world ucs.
For to change the position the translate coordinate method is needed.for to change the x,y,z vector the translate with matrix is needed.



