我试图获得曲线的长度,但我收到的消息:MissingMemberException: 'Guid' object has no attribute 'length'C#中的相同脚本完美无缺.python翻译有什么问题?这是文档.
蟒蛇:
import rhinoscriptsyntax as rs
ln = rs.AddLine(pt1, pt2)
a = ln
b = ln.Length
Run Code Online (Sandbox Code Playgroud)
C#:
Line ln;
ln = new Line(pt1, pt2);
A = ln;
B = ln.Length;
Run Code Online (Sandbox Code Playgroud) 我试图仅使用HTML而不使用CSS来居中图像,这可能吗?我试过以下代码:
<a href="link">
<img src="URL" align="center"></a>
Run Code Online (Sandbox Code Playgroud)
但是图像不会移动.我怎么解决这个问题?
我试图居中的图像是我们博客右栏上的捐赠按钮我将链接放在"文本"小部件中,因此CSS似乎无法在那里工作.
我试图使用String.Split方法在每个单独的行拆分我的字符串列表,但下面的方法和正则表达式方法都不起作用.相反,它们返回以下结果{0}
0. System.String[]而不是实际的字符串数组.请帮助找到以下代码中的错误:
string m_settings_temp;
string[] m_settings;
public void ShowSettingsGui() {
var dialog = new OpenFileDialog { Filter = "Data Sources (*.ini)|*.ini*|All Files|*.*" };
if (dialog.ShowDialog() != DialogResult.OK) return;
m_settings_temp = File.ReadAllText(dialog.FileName);
m_settings = m_settings_temp.Split(new [] { '\r', '\n' });
//This regex method failed as well:
//m_settings = Regex.Split(m_settings_temp,"\r\n|\r|\n");
}
//The method below is to evaluate the output
protected override void SolveInstance(IGH_DataAccess DA)
{
if (m_settings == null)
{
AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "You must declare some valid settings"); …Run Code Online (Sandbox Code Playgroud) 为什么我在下面的C#LINQ代码中收到以下错误
DriveInfo does not exist in current context?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
var drives = DriveInfo.GetDrives()
.Where(drive => drive.IsReady && drive.DriveType == DriveType.Removable);
}
}
}
Run Code Online (Sandbox Code Playgroud)
提前谢谢了!
符号?在以下代码中的含义是什么:
for(int i = 0 ; i < Hpts.BranchCount;i++)
{ foreach(Point3d pr in Hpts.Branches[i]){
minX = (minX > pt.X) ? pt.X : minX;
minY = (minY > pt.Y) ? pt.Y : minX;
maxX = (maxX > pt.X) ? maxX : pt.X;
maxY = (maxY > pt.Y) ? maxY : pt.Y;
}
}
Run Code Online (Sandbox Code Playgroud) 是什么double.MaxValue和double.MinValue意味着在以下方面:
double minX, minY, maxX, maxY;
minX = double.MaxValue;
minY = double.MaxValue;
maxX = double.MinValue;
maxY = double.MinValue;
for(int i = 0 ; i < HPts.BranchCount; i++){
foreach(Point3d pt in HPts.Branch(i)){
if(minX > pt.X){
minX = pt.X;
}
if(minY > pt.Y){
minY = pt.Y;
}
if(maxX < pt.X){
maxX = pt.X;
}
if(maxY < pt.Y){
maxY = pt.Y;
}
Run Code Online (Sandbox Code Playgroud) 在下面输入非常简单的脚本时,我在Python上收到消息"SyntaxError:unexpected EOF".我做错了什么,这个消息是什么意思?非常感谢.
c = 5
d = c*c
print("the type of d is"+ str(type(d))
Run Code Online (Sandbox Code Playgroud) 在Visual Studio C#Express上运行下面的脚本时,我收到以下错误消息:
if(ofd.ShowDialog()== true):错误1运算符'=='不能应用于'System.Windows.Forms.DialogResult'和'bool'类型的操作数
我该怎么解决这个问题?代码如下:
public override GH_ObjectResponse RespondToMouseDoubleClick(GH_Canvas sender, GH_CanvasMouseEvent e)
{
System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
ofd.Multiselect = true;
ofd.Filter = "Data Sources (*.ini)|*.ini*|All Files|*.*";
if (ofd.ShowDialog() == true)
{
string[] filePath = ofd.FileNames;
string[] safeFilePath = ofd.SafeFileNames;
}
return base.RespondToMouseDoubleClick(sender, e);
}
Run Code Online (Sandbox Code Playgroud) 在下面的代码中,我收到错误
属性,索引器或动态成员访问可能不会作为out或ref参数传递?
在m_settings.Length编译它时的参数.我该怎么解决这个问题?
public override bool Read(GH_IO.Serialization.GH_IReader reader)
{
if (m_settings != null && m_settings.Length > 0)
{
reader.TryGetInt32("StringCount", ref m_settings.Length);
for (int i = 0; i < m_settings.Length; i++)
{
reader.TryGetString("String", i, ref m_settings[i]);
}
}
return base.Read(reader);
}
Run Code Online (Sandbox Code Playgroud) 我试图使用DivideByLength基于RhinoCommon SDK的下面的方法,但我无法理解第三个参数是什么.我试图基于此方法编写下面的代码但我收到以下错误消息:Error: 'Rhino.Geometry.Point3d' is a 'type' but is used like a 'variable'
我认为第三个参数是指定我想要点作为输出而不是双倍.我究竟做错了什么?
方法:
Public Function DivideByLength ( _
segmentLength As Double, _
includeStart As Boolean, _
<OutAttribute> ByRef points As Point3d() _
) As Double()
Run Code Online (Sandbox Code Playgroud)
码:
List<Point3d> pts = new List<Point3d>();
for(int i = 0; i < crv.Count;i = i + 2)
{
pts.Add(crv[i].DivideByLength(nb, true, out Point3d()));
}
Run Code Online (Sandbox Code Playgroud)