Home > Software engineering >  VBA is used for contour reconstruction
VBA is used for contour reconstruction

Time:09-19

AutoCAD VBA reconstruction based on the data of image contour model,
Through MATLAB to generate an image contour, save the contour data after using AutoCADVBA to reconstruction model, but after the run has been an error:
Run after prompt error:

For four months, looking for has been fruitless,
O god!

 Sub QSGS () 
Open "D: \ \ Matlab R2012b \ work \ QSGS \ porous TXT" For Input As # 1
Input the # 1, Sumpoints:
'Inout # 1 means read single char
ReDim points (0 To Sumline * 3-1) As a Double
'on the line here means the row
Dim plineObj As AcadPolyline
Npoints=0
For I=1 To Sumpoints' Loop through all points
Input # 1, get coordinate of x, y x, y '
Points (npoints)=x 'x coordinate of the point I
Points (npoints + 1)=y 'y coordinate of the point I
Points (npoints + 2)=0 'z coordinate of the point I
Npoints=npoints + 3
Next I
The Set plineObj=ThisDrawing. ModelSpace. AddPolyline (points)
ZoomAll
The Close
End Sub



Source:
Li Renmin etc, using the method of four parameters to generate random growth structure of clay microstructure

CodePudding user response:

To run this code,
If the pop-up is "position a, Sumline<=0!" You should inspect Sumline initial value, the value is not in your in this function, the duty less than or equal to zero, an
If the pop-up "position two, I value is too large, check 1 ~ Sumpoints isn't correct!" You should pay attention To your For loop, For I=1 To Sumpoints
Here Sumpoints value nor to Ming Sumpoints and Sumline is the relationship between the value of
 
Sub QSGS ()
Open "D: \ \ Matlab R2012b \ work \ QSGS \ porous TXT" For Input As # 1
Input the # 1, Sumpoints:
'Inout # 1 means read single char
If SumlineReDim points (0 To Sumline * 3-1) As a Double
'on the line here means the row
Dim plineObj As AcadPolyline
Npoints=0
For I=1 To Sumpoints' Loop through all points
Input # 1, get coordinate of x, y x, y '
If npoints + 2 & gt; Ubound (points) then msgbox "position two, high value, I check the 1 ~ Sumpoints is right!" & VBCRLF & amp; "Sumpoints=" & amp; CSTR (Sumpoints) & amp; ", Sumline="& amp; CSTR (Sumline) & amp;" The relationship between the two should be wrong, "
Points (npoints)=x 'x coordinate of the point I
Points (npoints + 1)=y 'y coordinate of the point I
Points (npoints + 2)=0 'z coordinate of the point I
Npoints=npoints + 3
Next I
The Set plineObj=ThisDrawing. ModelSpace. AddPolyline (points)
ZoomAll
The Close
End Sub

CodePudding user response:

Quotes have the wrong number, lest thou shouldest say operation error, I changed the
 
Sub QSGS ()
Open "D: \ \ Matlab R2012b \ work \ QSGS \ porous TXT" For Input As # 1
Input the # 1, Sumpoints:
'Inout # 1 means read single char
If SumlineReDim points (0 To Sumline * 3-1) As a Double
'on the line here means the row
Dim plineObj As AcadPolyline
Npoints=0
For I=1 To Sumpoints' Loop through all points
Input # 1, get coordinate of x, y x, y '
If npoints + 2 & gt; Ubound (points) then msgbox "position two, high value, I check the 1 ~ Sumpoints is right!" & VBCRLF & amp; "Sumpoints=" & amp; CSTR (Sumpoints) & amp; ", Sumline="& amp; CSTR (Sumline) & amp;" The relationship between the two should be wrong, "
Points (npoints)=x 'x coordinate of the point I
Points (npoints + 1)=y 'y coordinate of the point I
Points (npoints + 2)=0 'z coordinate of the point I
Npoints=npoints + 3
Next I
The Set plineObj=ThisDrawing. ModelSpace. AddPolyline (points)
ZoomAll
The Close
End Sub

CodePudding user response:

reference 1st floor bakw response:
run this code,
If the pop-up is "position a, Sumline<=0!" You should inspect Sumline initial value, the value is not in your in this function, the duty less than or equal to zero, an
If the pop-up "position two, I value is too large, check 1 ~ Sumpoints isn't correct!" You should pay attention To your For loop, For I=1 To Sumpoints
Here Sumpoints value nor to Ming Sumpoints and Sumline is the relationship between the value of
 
Sub QSGS ()
Open "D: \ \ Matlab R2012b \ work \ QSGS \ porous TXT" For Input As # 1
Input the # 1, Sumpoints:
'Inout # 1 means read single char
If SumlineReDim points (0 To Sumline * 3-1) As a Double
'on the line here means the row
Dim plineObj As AcadPolyline
Npoints=0
For I=1 To Sumpoints' Loop through all points
Input # 1, get coordinate of x, y x, y '
If npoints + 2 & gt; Ubound (points) then msgbox "position two, high value, I check the 1 ~ Sumpoints is right!" & VBCRLF & amp; "Sumpoints=" & amp; CSTR (Sumpoints) & amp; ", Sumline="& amp; CSTR (Sumline) & amp;" The relationship between the two should be wrong, "
Points (npoints)=x 'x coordinate of the point I
Points (npoints + 1)=y 'y coordinate of the point I
Points (npoints + 2)=0 'z coordinate of the point I
Npoints=npoints + 3
Next I
The Set plineObj=ThisDrawing. ModelSpace. AddPolyline (points)
ZoomAll
The Close
End Sub

Pat...
Just don't understand the Sumpoints and Sumline here is how come of, because the paper only gives such a program, there is no data of porous. TXT data...

CodePudding user response:

I don't know your problem solving

CodePudding user response:

reference 4 floor xiaxuetian3425 response:
I don't know your problem solving no
no, have not been out, gave up ~

CodePudding user response:

The original poster hello, can you tell me the part of the matlab program, do you have? Could you add a qq's exchange 870971873
  •  Tags:  
  • VBA
  • Related