這篇文章主要介紹UFUN和NXOPEN中的變換矩陣區(qū)別有哪些,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

UFUN中用于實(shí)體變換矩陣的函數(shù)為:
UF_MODL_transform_entities
NXOPEN中用于裝配組件變換矩陣的類為:
ComponentNetwork
它們的變換矩陣方式是不同的,前者為動(dòng)態(tài)變換,后者為靜態(tài)變換。
動(dòng)態(tài)變換求法:
var invert = Current.Inverse(); var trans = invert.Multiply(position);
靜態(tài)變換求法(先旋轉(zhuǎn)后平移):
var cur = Current; cur.Transpose();//轉(zhuǎn)置 var pos = position; pos.Transpose();//轉(zhuǎn)置 var trans = cur.Inverse().Multiply(pos); var rotation = trans.UpperLeft.ToMatrix3x3(); trans.Transpose(); var translation = trans.Translation.ToVector3d();
分享下我的兩個(gè)移動(dòng)相關(guān)的類(部分相關(guān)類沒有提供):
public class MoveComponentBuilder
{
#region Constructors
protected MoveComponentBuilder()
{
var workPart = theSession.Parts.Work;
_positioner = workPart.ComponentAssembly.Positioner;
_netWork = (ComponentNetwork)_positioner.EstablishNetwork();
}
public static MoveComponentBuilder Create(List<Component> components, Matrix44 matrix)
{
var mCompBuilder = new MoveComponentBuilder();
mCompBuilder.Current = matrix;
mCompBuilder.HomePosition = matrix;
mCompBuilder.Components.AddRange(components);
mCompBuilder._netWork.SetMovingGroup(components.ToArray());
mCompBuilder._netWork.MoveObjectsState = true;
return mCompBuilder;
}
public static MoveComponentBuilder Create(List<Component> components,SpecifyOrientation manip)
{
var mCompBuilder = Create(components, manip.GetPosition());
mCompBuilder.Manip = manip;
return mCompBuilder;
}
#endregion
#region Fields
private Positioner _positioner;
private ComponentNetwork _netWork;
private Session theSession = Session.GetSession();
#endregion
#region Properties
public Matrix44 Current { get; protected set; }
public Matrix44 HomePosition { get; protected set; }
public List<Component> Components { get; protected set; } = new List<Component>();
public SpecifyOrientation Manip { get; protected set; }
#endregion
#region Methods
public void Move(Matrix44 position)
{
var cur = Current;
cur.Transpose();//轉(zhuǎn)置
var pos = position;
pos.Transpose();//轉(zhuǎn)置
var trans = cur.Inverse().Multiply(pos);
var rotation = trans.UpperLeft.ToMatrix3x3();
trans.Transpose();
var translation = trans.Translation.ToVector3d();
_netWork.BeginDrag();
_netWork.DragByTransform(translation,rotation);
_netWork.EndDrag();
Current = position;
}
public void BackHome()
{
Move(HomePosition);
}
public bool Update()
{
if (Manip==null)
{
return false;
}
Move(Manip.GetPosition());
return true;
}
public bool UpdateManipOnly()
{
if (Manip==null)
{
return false;
}
Current = Manip.GetPosition();
return true;
}
public void Apply()
{
_netWork.Solve();
}
#endregion
}public class MoveObjectBuilder
{
#region Conductor
protected MoveObjectBuilder() { }
public static MoveObjectBuilder Create(List<Tag> objs, Matrix44 matrix)
{
var mObj = new MoveObjectBuilder();
mObj.Current = matrix;
mObj.HomePosition = matrix;
mObj.Objects.AddRange(objs);
return mObj;
}
public static MoveObjectBuilder Create(List<Tag> objs, SpecifyOrientation manip)
{
var mObj = Create(objs, manip.GetPosition());
mObj.Manip = manip;
return mObj;
}
#endregion
#region Fields
private static UFSession theUfSession = UFSession.GetUFSession();
private static Session theSession = Session.GetSession();
#endregion
#region Properties
public List<Tag> Objects { get; protected set; } = new List<Tag>();
public Matrix44 Current { get; protected set; }
public Matrix44 HomePosition { get; protected set; }
public SpecifyOrientation Manip { get; protected set; }
#endregion
#region Methods
public void Move(Matrix44 position)
{
var invert = Current.Inverse();
var trans = invert.Multiply(position);
theUfSession.Modl.TransformEntities(
Objects.Count, Objects.ToArray(), trans.ToArray());
Current = position;
theUfSession.Modl.Update();
}
public void BackHome()
{
Move(HomePosition);
}
public bool Update()
{
if (Manip == null)
{
return false;
}
Move(Manip.GetPosition());
return true;
}
public bool UpdateManipOnly()
{
if (Manip==null)
{
return false;
}
Current = Manip.GetPosition();
return true;
}
#endregion
}演示:

以上是“UFUN和NXOPEN中的變換矩陣區(qū)別有哪些”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!
分享題目:UFUN和NXOPEN中的變換矩陣區(qū)別有哪些-創(chuàng)新互聯(lián)
當(dāng)前URL:http://chinadenli.net/article0/dhojio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)頁(yè)設(shè)計(jì)公司、外貿(mào)網(wǎng)站建設(shè)、營(yíng)銷型網(wǎng)站建設(shè)、服務(wù)器托管、虛擬主機(jī)、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容