獲取 2D 圖紙構件包圍框的方法跟 3D 模型的不太一樣,下面是樣例(從 Viewer3D.js 里頭截取來的):
function find2DBounds( fragList, fragId, dbId, bc ) {
const mesh = fragList.getVizmesh( fragId );
const vbr = new Autodesk.Viewing.Private.VertexBufferReader( mesh.geometry );
vbr.enumGeomsForObject( dbId, bc );
}
function get2DBounds( dbId, model ) {
const it = model.getData().instanceTree;
const fragList = model.getFragmentList();
let bounds = new THREE.Box3();
let bc = new Autodesk.Viewing.Private.BoundsCallback( bounds );
const dbId2fragId = model.getData().fragments.dbId2fragId;
const fragIds = dbId2fragId[dbId];
if( Array.isArray( fragIds ) ) {
for( let i = 0; i < fragIds.length; i++ ) {
find2DBounds( fragList, fragIds[i], dbId, bc );
}
} else if( typeof fragIds === 'number' ) {
find2DBounds( fragList, fragIds, dbId, bc );
}
return bc.bounds;
}
// 包圍匡
cosnt bondingBox = get2DBounds( dbId, viewer.model );這里就是你的父項目的相關信息,有時還有個relativePath指定父項目的pom.xml文件。
舉個例子,我創(chuàng)建了個項目cloud-demo,它的pom.xml配置為:
<project>
...
<groupId>com.example</groupId>
<artifactId>cloud-demo</artifactId>
<version>1.0-SNAPSHOT</version>
...
<!-- 子模塊 -->
<modules>
<module>server-module</module>
</modules>
...
</project>
然后,在該項目下創(chuàng)建子模塊server-module,那么子模塊中應該是這樣寫:
<project>
...
<artifactId>server-module</artifactId>
<version>1.0-SNAPSHOT</version>
...
<parent>
<groupId>com.example</groupId>
<artifactId>cloud-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
...
</project>自己解決一下,在找相關資料的時候看到的:
And finally if we deploy application with Capistrano we have to deploy it properly. We should put local_env.yml to the Capistrano shared folder on the server and change config/deploy.rb like this:
before 'deploy:assets:precompile', :symlink_config_files
desc "Link shared files"
task :symlink_config_files do
symlinks = {
"#{shared_path}/config/database.yml" => "#{release_path}/config/database.yml",
"#{shared_path}/config/local_env.yml" => "#{release_path}/config/local_env.yml"
}
run symlinks.map{|from, to| "ln -nfs #{from} #{to}"}.join(" && ")
end
于是我在自己的rails application中找到config/deploy.rb,里面有一行是:
append :linked_files, "config/database.yml", "config/secrets.yml"
于是我試著把application.yml加到后面去,再次嘗試部署成功。
服務器上的ss加密和ss客戶端的加密方式不一樣,修改后解決了
修改配置文件的加密方式,然后重啟ss就可以上谷歌了
可以的,在 Forge Viewer 里頭有很多方法可以做到這點,這邊我會以 AutoCam.goToView() 來示范,以下樣例假設相機的新位置是 ( x1, y1, z1 ):
// 獲取當前相機信息
const currentView = viewer.autocam.getCurrentView();
cosnt eye = viewer.navigation.getEyeVector();
const eyeDir = viewVec.normalize();
const distance = eye.length(); //!<<< 相機與焦點的距離
const newPosition = new THREE.Vector3( x1, y1, z1 ); //!<<< 相機的新位置
const target = eye.add( newPosition ); //!<<< 計算新焦點位置
// 產生新相機信息
const newView = {
position: newPosition.clone(), //!<<< 相機的新位置
up: currentView.up.clone(),
center: target.clone(), //!<<< 相機的新焦點
pivot: target.clone(), //!<<< 相機的新環(huán)繞(Orbit)中心
fov: currentView.fov,
worldUp: currentView.worldUp.clone(),
isOrtho: (currentView.isOrtho === false)
};
// 將信息更新到相機上
viewer.autocam.goToView( newView );
以上希望對你幫助~
top看下服務器負載高不高,是否有被攻擊,查看一下當前各連接狀態(tài)(SYN_RECV、FIN_WAIT、TIME_WAIT、ESTABLISHED)的數(shù)量。把iptables打開看看一段時間后會不會下降。
運行一個應用, 然后配置虛擬主機. wordrepss1 wordpress2.
unloadModel 后,要調用 viewer.tearDown(); 載入模型占用的資源才會釋放,如果要在載入新的模型在調用 viewer.loadModel(...); 前要先調用 viewer.setUp();。
<!DOCTYPE html>
<html>
<body>
<audio id="myAudio" autoplay controls loop>
<source src="/i/horse.ogg" type="audio/ogg">
<source src="/i/horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<p id="demo"></p>
<button onclick="myFunction()">切換</button>
<script>
function myFunction()
{
var audio = document.getElementById("myAudio");
if(audio.paused){
audio.play();
}else{
audio.pause();
}
}
</script>
</body>
</html>
這個代碼粘貼到這里 http://www.w3school.com.cn/ti...。
哦哦 知道了 樓上也是這個答案,謝謝 沒辦法采納你的答案了
path_info問題?
在controller上,把你所定義的header項轉化成類似的形式賦值給Session之類的。
相當于在外面套了一層封裝吧。
你講的太籠統(tǒng),猜測大概可以通過上述方法實現(xiàn)
url策略一般是默認必須鑒權,帶"/xxx/"的是公開接口跳過鑒權,未必非得是前綴,否則影響路由規(guī)則.和服務方開發(fā)約定好url規(guī)則
viewer有方法:self.viewer.model.getVisibleBounds();
之后將獲取得到的值返回給setplanes,實現(xiàn)剖切
// 直接獲取
viewer.getSelection();
//或者監(jiān)聽選擇集變更事件
var onSelectionChanged = function( event ) {
console.log( event.dbIdArray );
};
viewer.addEventListener(
Autodesk.Viewing.SELECTION_CHANGED_EVENT,
onSelectionChanged
);
2、獲取選擇構件的屬性
//直接獲取屬性
var onPropsFeteched = function( result ) {
console.log( result.properties );
}
var onFetchingPropsFailed = function( error, message ) {
console.error( error, message );
}
viewer.getProperties(
dbId,
onPropsFeteched,
onFetchingPropsFailed
);
// 從給予的 dbId 里獲取所有擁有特定屬性的構件
// https://forge.autodesk.com/blog/getbulkproperties-method
viewer.model.getBulkProperties( dbIds, ['屬性名稱'],
function( elements ) {
for(var i=0; i<elements.length; i++){
console.log( elements[i].properties[0] );
}
});
// 通過查找功能
// https://segmentfault.com/a/1190000010977818
viewer.search(
"屬性值",
function( dbIds ) {
console.log( dbIds );
},
["屬性名稱"]
);
3、添加構件屬性
你的標題似乎跟內文不符,我先回答標題的問題,F(xiàn)orge 轉換的模型跟屬性是不可修改的,所以無法添加;或者通過自訂屬性窗顯示自己的屬性 https://segmentfault.com/a/11...
至于內文的添加圖標部份,可以參考這些樣例:
Markup 3D
P.S. 建議可以到查找樣例 https://github.com/Autodesk-F...
可以用 viewer.hide()
1.請求的時候是否帶上參數(shù)e
2.e的時間是否校準,和服務器時間比較是否有時區(qū)差別
解決了
問題原因:阿里云默認關閉其他端口
需要在阿里云web管理界面 安全組創(chuàng)建規(guī)則,見圖
可以通過下列方式拿到構件樹:
var it = viewer.model.getData().instanceTree;
//或
viewer.getObjectTree(function( instanceTree ) {
console.log( instanceTree );
});
因數(shù)據(jù)優(yōu)化的緣故,所有數(shù)據(jù)都是平坦化過的,要重建數(shù)據(jù)結構可以通過:
function buildModelTree( model ) {
//builds model tree recursively
function _buildModelTreeRec( node ) {
it.enumNodeChildren( node.dbId, function(childId) {
node.children = node.children || [];
var childNode = {
dbId: childId,
name: it.getNodeName( childId )
};
node.children.push( childNode );
_buildModelTreeRec( childNode );
});
}
//get model instance tree and root component
var it = model.getData().instanceTree;
var rootId = it.getRootId();
var rootNode = {
dbId: rootId,
name: it.getNodeName( rootId )
};
_buildModelTreeRec( rootNode );
return rootNode;
}
var root = buildModelTree( viewer.model );北大青鳥APTECH成立于1999年。依托北京大學優(yōu)質雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達內教育集團成立于2002年,是一家由留學海歸創(chuàng)辦的高端職業(yè)教育培訓機構,是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學校辦產業(yè)為響應國家深化產教融合/校企合作的政策,積極推進“中國制造2025”,實現(xiàn)中華民族偉大復興的升級產業(yè)鏈。利用北京大學優(yōu)質教育資源及背
博為峰,中國職業(yè)人才培訓領域的先行者
曾工作于聯(lián)想擔任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔任項目經理從事移動互聯(lián)網管理及研發(fā)工作,曾創(chuàng)辦藍懿科技有限責任公司從事總經理職務負責iOS教學及管理工作。
浪潮集團項目經理。精通Java與.NET 技術, 熟練的跨平臺面向對象開發(fā)經驗,技術功底深厚。 授課風格 授課風格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網頁制作和網頁游戲開發(fā)。
具有10 年的Java 企業(yè)應用開發(fā)經驗。曾經歷任德國Software AG 技術顧問,美國Dachieve 系統(tǒng)架構師,美國AngelEngineers Inc. 系統(tǒng)架構師。